github.com/stellar/stellar-etl@v1.0.1-0.20240312145900-4874b6bf2b89/internal/transform/operation_test.go (about) 1 package transform 2 3 import ( 4 "encoding/base64" 5 "fmt" 6 "testing" 7 8 "github.com/stretchr/testify/assert" 9 10 "github.com/stellar/go/ingest" 11 "github.com/stellar/go/xdr" 12 ) 13 14 func TestTransformOperation(t *testing.T) { 15 type operationInput struct { 16 operation xdr.Operation 17 index int32 18 transaction ingest.LedgerTransaction 19 ledgerClosedMeta xdr.LedgerCloseMeta 20 } 21 type transformTest struct { 22 input operationInput 23 wantOutput OperationOutput 24 wantErr error 25 } 26 genericInput := operationInput{ 27 operation: genericBumpOperation, 28 index: 1, 29 transaction: genericLedgerTransaction, 30 } 31 32 negativeOpTypeInput := genericInput 33 negativeOpTypeEnvelope := genericBumpOperationEnvelope 34 negativeOpTypeEnvelope.Tx.Operations[0].Body.Type = xdr.OperationType(-1) 35 negativeOpTypeInput.operation.Body.Type = xdr.OperationType(-1) 36 negativeOpTypeInput.transaction.Envelope.V1 = &negativeOpTypeEnvelope 37 38 unknownOpTypeInput := genericInput 39 unknownOpTypeEnvelope := genericBumpOperationEnvelope 40 unknownOpTypeEnvelope.Tx.Operations[0].Body.Type = xdr.OperationType(99) 41 unknownOpTypeInput.operation.Body.Type = xdr.OperationType(99) 42 unknownOpTypeInput.transaction.Envelope.V1 = &unknownOpTypeEnvelope 43 44 tests := []transformTest{ 45 { 46 negativeOpTypeInput, 47 OperationOutput{}, 48 fmt.Errorf("The operation type (-1) is negative for operation 1 (operation id=4098)"), 49 }, 50 { 51 unknownOpTypeInput, 52 OperationOutput{}, 53 fmt.Errorf("Unknown operation type: "), 54 }, 55 } 56 hardCodedInputTransaction, err := makeOperationTestInput() 57 assert.NoError(t, err) 58 hardCodedOutputArray := makeOperationTestOutputs() 59 hardCodedInputLedgerCloseMeta := makeLedgerCloseMeta() 60 61 for i, op := range hardCodedInputTransaction.Envelope.Operations() { 62 tests = append(tests, transformTest{ 63 input: operationInput{op, int32(i), hardCodedInputTransaction, hardCodedInputLedgerCloseMeta}, 64 wantOutput: hardCodedOutputArray[i], 65 wantErr: nil, 66 }) 67 } 68 69 for _, test := range tests { 70 actualOutput, actualError := TransformOperation(test.input.operation, test.input.index, test.input.transaction, 0, test.input.ledgerClosedMeta, "") 71 assert.Equal(t, test.wantErr, actualError) 72 assert.Equal(t, test.wantOutput, actualOutput) 73 } 74 } 75 76 func makeLedgerCloseMeta() (ledgerCloseMeta xdr.LedgerCloseMeta) { 77 return xdr.LedgerCloseMeta{ 78 V: 0, 79 V0: &xdr.LedgerCloseMetaV0{ 80 LedgerHeader: xdr.LedgerHeaderHistoryEntry{ 81 Header: xdr.LedgerHeader{ 82 ScpValue: xdr.StellarValue{ 83 CloseTime: 0, 84 }, 85 }, 86 }, 87 }, 88 } 89 } 90 91 // Creates a single transaction that contains one of every operation type 92 func makeOperationTestInput() (inputTransaction ingest.LedgerTransaction, err error) { 93 inputTransaction = genericLedgerTransaction 94 inputEnvelope := genericBumpOperationEnvelope 95 96 inputEnvelope.Tx.SourceAccount = testAccount3 97 hardCodedInflationDest := testAccount4ID 98 99 hardCodedTrustAsset, err := usdtAsset.ToAssetCode("USDT") 100 if err != nil { 101 return 102 } 103 104 //var wasm []byte 105 //var contractHash xdr.Hash 106 //var salt [32]byte 107 //var assetCode [12]byte 108 //var assetIssuer xdr.Uint256 109 110 hardCodedClearFlags := xdr.Uint32(3) 111 hardCodedSetFlags := xdr.Uint32(4) 112 hardCodedMasterWeight := xdr.Uint32(3) 113 hardCodedLowThresh := xdr.Uint32(1) 114 hardCodedMedThresh := xdr.Uint32(3) 115 hardCodedHighThresh := xdr.Uint32(5) 116 hardCodedHomeDomain := xdr.String32("2019=DRA;n-test") 117 hardCodedSignerKey, err := xdr.NewSignerKey(xdr.SignerKeyTypeSignerKeyTypeEd25519, xdr.Uint256([32]byte{})) 118 if err != nil { 119 return 120 } 121 122 hardCodedSigner := xdr.Signer{ 123 Key: hardCodedSignerKey, 124 Weight: xdr.Uint32(1), 125 } 126 127 hardCodedClaimableBalance := genericClaimableBalance 128 hardCodedClaimant := testClaimant 129 hardCodedDataValue := xdr.DataValue([]byte{0x76, 0x61, 0x6c, 0x75, 0x65}) 130 hardCodedSequenceNumber := xdr.SequenceNumber(100) 131 inputOperations := []xdr.Operation{ 132 xdr.Operation{ 133 SourceAccount: nil, 134 Body: xdr.OperationBody{ 135 Type: xdr.OperationTypeCreateAccount, 136 CreateAccountOp: &xdr.CreateAccountOp{ 137 StartingBalance: 25000000, 138 Destination: testAccount4ID, 139 }, 140 }, 141 }, 142 xdr.Operation{ 143 SourceAccount: nil, 144 Body: xdr.OperationBody{ 145 Type: xdr.OperationTypePayment, 146 PaymentOp: &xdr.PaymentOp{ 147 Destination: testAccount4, 148 Asset: usdtAsset, 149 Amount: 350000000, 150 }, 151 }, 152 }, 153 xdr.Operation{ 154 SourceAccount: nil, 155 Body: xdr.OperationBody{ 156 Type: xdr.OperationTypePayment, 157 PaymentOp: &xdr.PaymentOp{ 158 Destination: testAccount4, 159 Asset: nativeAsset, 160 Amount: 350000000, 161 }, 162 }, 163 }, 164 xdr.Operation{ 165 SourceAccount: &testAccount3, 166 Body: xdr.OperationBody{ 167 Type: xdr.OperationTypePathPaymentStrictReceive, 168 PathPaymentStrictReceiveOp: &xdr.PathPaymentStrictReceiveOp{ 169 SendAsset: nativeAsset, 170 SendMax: 8951495900, 171 Destination: testAccount4, 172 DestAsset: nativeAsset, 173 DestAmount: 8951495900, 174 Path: []xdr.Asset{usdtAsset}, 175 }, 176 }, 177 }, 178 xdr.Operation{ 179 SourceAccount: nil, 180 Body: xdr.OperationBody{ 181 Type: xdr.OperationTypeManageSellOffer, 182 ManageSellOfferOp: &xdr.ManageSellOfferOp{ 183 Selling: usdtAsset, 184 Buying: nativeAsset, 185 Amount: 765860000, 186 Price: xdr.Price{ 187 N: 128523, 188 D: 250000, 189 }, 190 OfferId: 0, 191 }, 192 }, 193 }, 194 xdr.Operation{ 195 SourceAccount: nil, 196 Body: xdr.OperationBody{ 197 Type: xdr.OperationTypeCreatePassiveSellOffer, 198 CreatePassiveSellOfferOp: &xdr.CreatePassiveSellOfferOp{ 199 Selling: nativeAsset, 200 Buying: usdtAsset, 201 Amount: 631595000, 202 Price: xdr.Price{ 203 N: 99583200, 204 D: 1257990000, 205 }, 206 }, 207 }, 208 }, 209 xdr.Operation{ 210 SourceAccount: nil, 211 Body: xdr.OperationBody{ 212 Type: xdr.OperationTypeSetOptions, 213 SetOptionsOp: &xdr.SetOptionsOp{ 214 InflationDest: &hardCodedInflationDest, 215 ClearFlags: &hardCodedClearFlags, 216 SetFlags: &hardCodedSetFlags, 217 MasterWeight: &hardCodedMasterWeight, 218 LowThreshold: &hardCodedLowThresh, 219 MedThreshold: &hardCodedMedThresh, 220 HighThreshold: &hardCodedHighThresh, 221 HomeDomain: &hardCodedHomeDomain, 222 Signer: &hardCodedSigner, 223 }, 224 }, 225 }, 226 xdr.Operation{ 227 SourceAccount: nil, 228 Body: xdr.OperationBody{ 229 Type: xdr.OperationTypeChangeTrust, 230 ChangeTrustOp: &xdr.ChangeTrustOp{ 231 Line: usdtChangeTrustAsset, 232 Limit: xdr.Int64(500000000000000000), 233 }, 234 }, 235 }, 236 xdr.Operation{ 237 SourceAccount: nil, 238 Body: xdr.OperationBody{ 239 Type: xdr.OperationTypeChangeTrust, 240 ChangeTrustOp: &xdr.ChangeTrustOp{ 241 Line: usdtLiquidityPoolShare, 242 Limit: xdr.Int64(500000000000000000), 243 }, 244 }, 245 }, 246 xdr.Operation{ 247 SourceAccount: nil, 248 Body: xdr.OperationBody{ 249 Type: xdr.OperationTypeAllowTrust, 250 AllowTrustOp: &xdr.AllowTrustOp{ 251 Trustor: testAccount4ID, 252 Asset: hardCodedTrustAsset, 253 Authorize: xdr.Uint32(1), 254 }, 255 }, 256 }, 257 xdr.Operation{ 258 SourceAccount: nil, 259 Body: xdr.OperationBody{ 260 Type: xdr.OperationTypeAccountMerge, 261 Destination: &testAccount4, 262 }, 263 }, 264 xdr.Operation{ 265 SourceAccount: nil, 266 Body: xdr.OperationBody{ 267 Type: xdr.OperationTypeInflation, 268 }, 269 }, 270 xdr.Operation{ 271 SourceAccount: nil, 272 Body: xdr.OperationBody{ 273 Type: xdr.OperationTypeManageData, 274 ManageDataOp: &xdr.ManageDataOp{ 275 DataName: "test", 276 DataValue: &hardCodedDataValue, 277 }, 278 }, 279 }, 280 xdr.Operation{ 281 SourceAccount: nil, 282 Body: xdr.OperationBody{ 283 Type: xdr.OperationTypeBumpSequence, 284 BumpSequenceOp: &xdr.BumpSequenceOp{ 285 BumpTo: hardCodedSequenceNumber, 286 }, 287 }, 288 }, 289 xdr.Operation{ 290 SourceAccount: nil, 291 Body: xdr.OperationBody{ 292 Type: xdr.OperationTypeManageBuyOffer, 293 ManageBuyOfferOp: &xdr.ManageBuyOfferOp{ 294 Selling: usdtAsset, 295 Buying: nativeAsset, 296 BuyAmount: 7654501001, 297 Price: xdr.Price{ 298 N: 635863285, 299 D: 1818402817, 300 }, 301 OfferId: 100, 302 }, 303 }, 304 }, 305 xdr.Operation{ 306 SourceAccount: nil, 307 Body: xdr.OperationBody{ 308 Type: xdr.OperationTypePathPaymentStrictSend, 309 PathPaymentStrictSendOp: &xdr.PathPaymentStrictSendOp{ 310 SendAsset: nativeAsset, 311 SendAmount: 1598182, 312 Destination: testAccount4, 313 DestAsset: nativeAsset, 314 DestMin: 4280460538, 315 Path: []xdr.Asset{usdtAsset}, 316 }, 317 }, 318 }, 319 xdr.Operation{ 320 SourceAccount: nil, 321 Body: xdr.OperationBody{ 322 Type: xdr.OperationTypeCreateClaimableBalance, 323 CreateClaimableBalanceOp: &xdr.CreateClaimableBalanceOp{ 324 Asset: usdtAsset, 325 Amount: 1234567890000, 326 Claimants: []xdr.Claimant{hardCodedClaimant}, 327 }, 328 }, 329 }, 330 xdr.Operation{ 331 SourceAccount: &testAccount3, 332 Body: xdr.OperationBody{ 333 Type: xdr.OperationTypeClaimClaimableBalance, 334 ClaimClaimableBalanceOp: &xdr.ClaimClaimableBalanceOp{ 335 BalanceId: hardCodedClaimableBalance, 336 }, 337 }, 338 }, 339 xdr.Operation{ 340 SourceAccount: nil, 341 Body: xdr.OperationBody{ 342 Type: xdr.OperationTypeBeginSponsoringFutureReserves, 343 BeginSponsoringFutureReservesOp: &xdr.BeginSponsoringFutureReservesOp{ 344 SponsoredId: testAccount4ID, 345 }, 346 }, 347 }, 348 xdr.Operation{ 349 SourceAccount: nil, 350 Body: xdr.OperationBody{ 351 Type: xdr.OperationTypeRevokeSponsorship, 352 RevokeSponsorshipOp: &xdr.RevokeSponsorshipOp{ 353 Type: xdr.RevokeSponsorshipTypeRevokeSponsorshipSigner, 354 Signer: &xdr.RevokeSponsorshipOpSigner{ 355 AccountId: testAccount4ID, 356 SignerKey: hardCodedSigner.Key, 357 }, 358 }, 359 }, 360 }, 361 xdr.Operation{ 362 SourceAccount: nil, 363 Body: xdr.OperationBody{ 364 Type: xdr.OperationTypeRevokeSponsorship, 365 RevokeSponsorshipOp: &xdr.RevokeSponsorshipOp{ 366 Type: xdr.RevokeSponsorshipTypeRevokeSponsorshipLedgerEntry, 367 LedgerKey: &xdr.LedgerKey{ 368 Type: xdr.LedgerEntryTypeAccount, 369 Account: &xdr.LedgerKeyAccount{ 370 AccountId: testAccount4ID, 371 }, 372 }, 373 }, 374 }, 375 }, 376 xdr.Operation{ 377 SourceAccount: nil, 378 Body: xdr.OperationBody{ 379 Type: xdr.OperationTypeRevokeSponsorship, 380 RevokeSponsorshipOp: &xdr.RevokeSponsorshipOp{ 381 Type: xdr.RevokeSponsorshipTypeRevokeSponsorshipLedgerEntry, 382 LedgerKey: &xdr.LedgerKey{ 383 Type: xdr.LedgerEntryTypeClaimableBalance, 384 ClaimableBalance: &xdr.LedgerKeyClaimableBalance{ 385 BalanceId: hardCodedClaimableBalance, 386 }, 387 }, 388 }, 389 }, 390 }, 391 xdr.Operation{ 392 SourceAccount: nil, 393 Body: xdr.OperationBody{ 394 Type: xdr.OperationTypeRevokeSponsorship, 395 RevokeSponsorshipOp: &xdr.RevokeSponsorshipOp{ 396 Type: xdr.RevokeSponsorshipTypeRevokeSponsorshipLedgerEntry, 397 LedgerKey: &xdr.LedgerKey{ 398 Type: xdr.LedgerEntryTypeData, 399 Data: &xdr.LedgerKeyData{ 400 AccountId: testAccount4ID, 401 DataName: "test", 402 }, 403 }, 404 }, 405 }, 406 }, 407 xdr.Operation{ 408 SourceAccount: nil, 409 Body: xdr.OperationBody{ 410 Type: xdr.OperationTypeRevokeSponsorship, 411 RevokeSponsorshipOp: &xdr.RevokeSponsorshipOp{ 412 Type: xdr.RevokeSponsorshipTypeRevokeSponsorshipLedgerEntry, 413 LedgerKey: &xdr.LedgerKey{ 414 Type: xdr.LedgerEntryTypeOffer, 415 Offer: &xdr.LedgerKeyOffer{ 416 SellerId: testAccount3ID, 417 OfferId: 100, 418 }, 419 }, 420 }, 421 }, 422 }, 423 xdr.Operation{ 424 SourceAccount: nil, 425 Body: xdr.OperationBody{ 426 Type: xdr.OperationTypeRevokeSponsorship, 427 RevokeSponsorshipOp: &xdr.RevokeSponsorshipOp{ 428 Type: xdr.RevokeSponsorshipTypeRevokeSponsorshipLedgerEntry, 429 LedgerKey: &xdr.LedgerKey{ 430 Type: xdr.LedgerEntryTypeTrustline, 431 TrustLine: &xdr.LedgerKeyTrustLine{ 432 AccountId: testAccount3ID, 433 Asset: usdtTrustLineAsset, 434 }, 435 }, 436 }, 437 }, 438 }, 439 xdr.Operation{ 440 SourceAccount: nil, 441 Body: xdr.OperationBody{ 442 Type: xdr.OperationTypeRevokeSponsorship, 443 RevokeSponsorshipOp: &xdr.RevokeSponsorshipOp{ 444 Type: xdr.RevokeSponsorshipTypeRevokeSponsorshipLedgerEntry, 445 LedgerKey: &xdr.LedgerKey{ 446 Type: xdr.LedgerEntryTypeLiquidityPool, 447 LiquidityPool: &xdr.LedgerKeyLiquidityPool{ 448 LiquidityPoolId: xdr.PoolId{1, 2, 3, 4, 5, 6, 7, 8, 9}, 449 }, 450 }, 451 }, 452 }, 453 }, 454 xdr.Operation{ 455 SourceAccount: nil, 456 Body: xdr.OperationBody{ 457 Type: xdr.OperationTypeClawback, 458 ClawbackOp: &xdr.ClawbackOp{ 459 Asset: usdtAsset, 460 From: testAccount4, 461 Amount: 1598182, 462 }, 463 }, 464 }, 465 xdr.Operation{ 466 SourceAccount: nil, 467 Body: xdr.OperationBody{ 468 Type: xdr.OperationTypeClawbackClaimableBalance, 469 ClawbackClaimableBalanceOp: &xdr.ClawbackClaimableBalanceOp{ 470 BalanceId: hardCodedClaimableBalance, 471 }, 472 }, 473 }, 474 xdr.Operation{ 475 SourceAccount: nil, 476 Body: xdr.OperationBody{ 477 Type: xdr.OperationTypeSetTrustLineFlags, 478 SetTrustLineFlagsOp: &xdr.SetTrustLineFlagsOp{ 479 Trustor: testAccount4ID, 480 Asset: usdtAsset, 481 SetFlags: hardCodedSetFlags, 482 ClearFlags: hardCodedClearFlags, 483 }, 484 }, 485 }, 486 xdr.Operation{ 487 SourceAccount: nil, 488 Body: xdr.OperationBody{ 489 Type: xdr.OperationTypeLiquidityPoolDeposit, 490 LiquidityPoolDepositOp: &xdr.LiquidityPoolDepositOp{ 491 LiquidityPoolId: xdr.PoolId{1, 2, 3, 4, 5, 6, 7, 8, 9}, 492 MaxAmountA: 1000, 493 MaxAmountB: 100, 494 MinPrice: xdr.Price{ 495 N: 1, 496 D: 1000000, 497 }, 498 MaxPrice: xdr.Price{ 499 N: 1000000, 500 D: 1, 501 }, 502 }, 503 }, 504 }, 505 xdr.Operation{ 506 SourceAccount: nil, 507 Body: xdr.OperationBody{ 508 Type: xdr.OperationTypeLiquidityPoolWithdraw, 509 LiquidityPoolWithdrawOp: &xdr.LiquidityPoolWithdrawOp{ 510 LiquidityPoolId: xdr.PoolId{1, 2, 3, 4, 5, 6, 7, 8, 9}, 511 Amount: 4, 512 MinAmountA: 1, 513 MinAmountB: 1, 514 }, 515 }, 516 }, 517 //xdr.Operation{ 518 // SourceAccount: nil, 519 // Body: xdr.OperationBody{ 520 // Type: xdr.OperationTypeInvokeHostFunction, 521 // InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ 522 // HostFunction: xdr.HostFunction{ 523 // Type: xdr.HostFunctionTypeHostFunctionTypeInvokeContract, 524 // InvokeContract: &xdr.InvokeContractArgs{ 525 // ContractAddress: xdr.ScAddress{ 526 // Type: xdr.ScAddressTypeScAddressTypeContract, 527 // ContractId: &contractHash, 528 // }, 529 // FunctionName: "test", 530 // Args: []xdr.ScVal{}, 531 // }, 532 // }, 533 // }, 534 // }, 535 //}, 536 //xdr.Operation{ 537 // SourceAccount: nil, 538 // Body: xdr.OperationBody{ 539 // Type: xdr.OperationTypeInvokeHostFunction, 540 // InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ 541 // HostFunction: xdr.HostFunction{ 542 // Type: xdr.HostFunctionTypeHostFunctionTypeCreateContract, 543 // CreateContract: &xdr.CreateContractArgs{ 544 // ContractIdPreimage: xdr.ContractIdPreimage{ 545 // Type: xdr.ContractIdPreimageTypeContractIdPreimageFromAddress, 546 // FromAddress: &xdr.ContractIdPreimageFromAddress{ 547 // Address: xdr.ScAddress{ 548 // Type: xdr.ScAddressTypeScAddressTypeContract, 549 // ContractId: &contractHash, 550 // }, 551 // Salt: salt, 552 // }, 553 // }, 554 // Executable: xdr.ContractExecutable{}, 555 // }, 556 // }, 557 // }, 558 // }, 559 //}, 560 //xdr.Operation{ 561 // SourceAccount: nil, 562 // Body: xdr.OperationBody{ 563 // Type: xdr.OperationTypeInvokeHostFunction, 564 // InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ 565 // HostFunction: xdr.HostFunction{ 566 // Type: xdr.HostFunctionTypeHostFunctionTypeCreateContract, 567 // CreateContract: &xdr.CreateContractArgs{ 568 // ContractIdPreimage: xdr.ContractIdPreimage{ 569 // Type: xdr.ContractIdPreimageTypeContractIdPreimageFromAsset, 570 // FromAsset: &xdr.Asset{ 571 // Type: xdr.AssetTypeAssetTypeCreditAlphanum12, 572 // AlphaNum12: &xdr.AlphaNum12{ 573 // AssetCode: assetCode, 574 // Issuer: xdr.AccountId{ 575 // Type: xdr.PublicKeyTypePublicKeyTypeEd25519, 576 // Ed25519: &assetIssuer, 577 // }, 578 // }, 579 // }, 580 // }, 581 // Executable: xdr.ContractExecutable{}, 582 // }, 583 // }, 584 // }, 585 // }, 586 //}, 587 //xdr.Operation{ 588 // SourceAccount: nil, 589 // Body: xdr.OperationBody{ 590 // Type: xdr.OperationTypeInvokeHostFunction, 591 // InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ 592 // HostFunction: xdr.HostFunction{ 593 // Type: xdr.HostFunctionTypeHostFunctionTypeUploadContractWasm, 594 // Wasm: &wasm, 595 // }, 596 // }, 597 // }, 598 //}, 599 //xdr.Operation{ 600 // SourceAccount: nil, 601 // Body: xdr.OperationBody{ 602 // Type: xdr.OperationTypeBumpFootprintExpiration, 603 // BumpFootprintExpirationOp: &xdr.BumpFootprintExpirationOp{ 604 // Ext: xdr.ExtensionPoint{ 605 // V: 0, 606 // }, 607 // LedgersToExpire: 1234, 608 // }, 609 // }, 610 //}, 611 //xdr.Operation{ 612 // SourceAccount: nil, 613 // Body: xdr.OperationBody{ 614 // Type: xdr.OperationTypeRestoreFootprint, 615 // RestoreFootprintOp: &xdr.RestoreFootprintOp{ 616 // Ext: xdr.ExtensionPoint{ 617 // V: 0, 618 // }, 619 // }, 620 // }, 621 //}, 622 } 623 inputEnvelope.Tx.Operations = inputOperations 624 results := []xdr.OperationResult{ 625 xdr.OperationResult{ 626 Code: xdr.OperationResultCodeOpInner, 627 Tr: &xdr.OperationResultTr{ 628 Type: xdr.OperationTypeCreateAccount, 629 CreateAccountResult: &xdr.CreateAccountResult{ 630 Code: xdr.CreateAccountResultCodeCreateAccountSuccess, 631 }, 632 }, 633 }, 634 xdr.OperationResult{ 635 Code: xdr.OperationResultCodeOpInner, 636 Tr: &xdr.OperationResultTr{ 637 Type: xdr.OperationTypePayment, 638 PaymentResult: &xdr.PaymentResult{ 639 Code: xdr.PaymentResultCodePaymentSuccess, 640 }, 641 }, 642 }, 643 xdr.OperationResult{ 644 Code: xdr.OperationResultCodeOpInner, 645 Tr: &xdr.OperationResultTr{ 646 Type: xdr.OperationTypePayment, 647 PaymentResult: &xdr.PaymentResult{ 648 Code: xdr.PaymentResultCodePaymentSuccess, 649 }, 650 }, 651 }, 652 // There needs to be a true result for path payment receive and send 653 xdr.OperationResult{ 654 Code: xdr.OperationResultCodeOpInner, 655 Tr: &xdr.OperationResultTr{ 656 Type: xdr.OperationTypePathPaymentStrictReceive, 657 PathPaymentStrictReceiveResult: &xdr.PathPaymentStrictReceiveResult{ 658 Code: xdr.PathPaymentStrictReceiveResultCodePathPaymentStrictReceiveSuccess, 659 Success: &xdr.PathPaymentStrictReceiveResultSuccess{ 660 Last: xdr.SimplePaymentResult{Amount: 8946764349}, 661 }, 662 }, 663 }, 664 }, 665 xdr.OperationResult{ 666 Code: xdr.OperationResultCodeOpInner, 667 Tr: &xdr.OperationResultTr{ 668 Type: xdr.OperationTypeManageSellOffer, 669 ManageSellOfferResult: &xdr.ManageSellOfferResult{ 670 Code: xdr.ManageSellOfferResultCodeManageSellOfferSuccess, 671 }, 672 }, 673 }, 674 xdr.OperationResult{ 675 Code: xdr.OperationResultCodeOpInner, 676 Tr: &xdr.OperationResultTr{ 677 Type: xdr.OperationTypeManageSellOffer, 678 ManageSellOfferResult: &xdr.ManageSellOfferResult{ 679 Code: xdr.ManageSellOfferResultCodeManageSellOfferSuccess, 680 }, 681 }, 682 }, 683 xdr.OperationResult{ 684 Code: xdr.OperationResultCodeOpInner, 685 Tr: &xdr.OperationResultTr{ 686 Type: xdr.OperationTypeSetOptions, 687 SetOptionsResult: &xdr.SetOptionsResult{ 688 Code: xdr.SetOptionsResultCodeSetOptionsSuccess, 689 }, 690 }, 691 }, 692 xdr.OperationResult{ 693 Code: xdr.OperationResultCodeOpInner, 694 Tr: &xdr.OperationResultTr{ 695 Type: xdr.OperationTypeChangeTrust, 696 ChangeTrustResult: &xdr.ChangeTrustResult{ 697 Code: xdr.ChangeTrustResultCodeChangeTrustSuccess, 698 }, 699 }, 700 }, 701 xdr.OperationResult{ 702 Code: xdr.OperationResultCodeOpInner, 703 Tr: &xdr.OperationResultTr{ 704 Type: xdr.OperationTypeChangeTrust, 705 ChangeTrustResult: &xdr.ChangeTrustResult{ 706 Code: xdr.ChangeTrustResultCodeChangeTrustSuccess, 707 }, 708 }, 709 }, 710 xdr.OperationResult{ 711 Code: xdr.OperationResultCodeOpInner, 712 Tr: &xdr.OperationResultTr{ 713 Type: xdr.OperationTypeAllowTrust, 714 AllowTrustResult: &xdr.AllowTrustResult{ 715 Code: xdr.AllowTrustResultCodeAllowTrustSuccess, 716 }, 717 }, 718 }, 719 xdr.OperationResult{ 720 Code: xdr.OperationResultCodeOpInner, 721 Tr: &xdr.OperationResultTr{ 722 Type: xdr.OperationTypeAccountMerge, 723 AccountMergeResult: &xdr.AccountMergeResult{ 724 Code: xdr.AccountMergeResultCodeAccountMergeSuccess, 725 }, 726 }, 727 }, 728 xdr.OperationResult{ 729 Code: xdr.OperationResultCodeOpInner, 730 Tr: &xdr.OperationResultTr{ 731 Type: xdr.OperationTypeInflation, 732 InflationResult: &xdr.InflationResult{ 733 Code: xdr.InflationResultCodeInflationSuccess, 734 }, 735 }, 736 }, 737 xdr.OperationResult{ 738 Code: xdr.OperationResultCodeOpInner, 739 Tr: &xdr.OperationResultTr{ 740 Type: xdr.OperationTypeManageData, 741 ManageDataResult: &xdr.ManageDataResult{ 742 Code: xdr.ManageDataResultCodeManageDataSuccess, 743 }, 744 }, 745 }, 746 xdr.OperationResult{ 747 Code: xdr.OperationResultCodeOpInner, 748 Tr: &xdr.OperationResultTr{ 749 Type: xdr.OperationTypeBumpSequence, 750 BumpSeqResult: &xdr.BumpSequenceResult{ 751 Code: xdr.BumpSequenceResultCodeBumpSequenceSuccess, 752 }, 753 }, 754 }, 755 xdr.OperationResult{ 756 Code: xdr.OperationResultCodeOpInner, 757 Tr: &xdr.OperationResultTr{ 758 Type: xdr.OperationTypeManageBuyOffer, 759 ManageBuyOfferResult: &xdr.ManageBuyOfferResult{ 760 Code: xdr.ManageBuyOfferResultCodeManageBuyOfferSuccess, 761 }, 762 }, 763 }, 764 xdr.OperationResult{ 765 Code: xdr.OperationResultCodeOpInner, 766 Tr: &xdr.OperationResultTr{ 767 Type: xdr.OperationTypePathPaymentStrictSend, 768 PathPaymentStrictSendResult: &xdr.PathPaymentStrictSendResult{ 769 Code: xdr.PathPaymentStrictSendResultCodePathPaymentStrictSendSuccess, 770 Success: &xdr.PathPaymentStrictSendResultSuccess{ 771 Last: xdr.SimplePaymentResult{Amount: 4334043858}, 772 }, 773 }, 774 }, 775 }, 776 xdr.OperationResult{ 777 Code: xdr.OperationResultCodeOpInner, 778 Tr: &xdr.OperationResultTr{ 779 Type: xdr.OperationTypeCreateClaimableBalance, 780 CreateClaimableBalanceResult: &xdr.CreateClaimableBalanceResult{ 781 Code: xdr.CreateClaimableBalanceResultCodeCreateClaimableBalanceSuccess, 782 }, 783 }, 784 }, 785 xdr.OperationResult{ 786 Code: xdr.OperationResultCodeOpInner, 787 Tr: &xdr.OperationResultTr{ 788 Type: xdr.OperationTypeClaimClaimableBalance, 789 ClaimClaimableBalanceResult: &xdr.ClaimClaimableBalanceResult{ 790 Code: xdr.ClaimClaimableBalanceResultCodeClaimClaimableBalanceSuccess, 791 }, 792 }, 793 }, 794 xdr.OperationResult{ 795 Code: xdr.OperationResultCodeOpInner, 796 Tr: &xdr.OperationResultTr{ 797 Type: xdr.OperationTypeBeginSponsoringFutureReserves, 798 BeginSponsoringFutureReservesResult: &xdr.BeginSponsoringFutureReservesResult{ 799 Code: xdr.BeginSponsoringFutureReservesResultCodeBeginSponsoringFutureReservesSuccess, 800 }, 801 }, 802 }, 803 xdr.OperationResult{ 804 Code: xdr.OperationResultCodeOpInner, 805 Tr: &xdr.OperationResultTr{ 806 Type: xdr.OperationTypeRevokeSponsorship, 807 RevokeSponsorshipResult: &xdr.RevokeSponsorshipResult{ 808 Code: xdr.RevokeSponsorshipResultCodeRevokeSponsorshipSuccess, 809 }, 810 }, 811 }, 812 xdr.OperationResult{ 813 Code: xdr.OperationResultCodeOpInner, 814 Tr: &xdr.OperationResultTr{ 815 Type: xdr.OperationTypeRevokeSponsorship, 816 RevokeSponsorshipResult: &xdr.RevokeSponsorshipResult{ 817 Code: xdr.RevokeSponsorshipResultCodeRevokeSponsorshipSuccess, 818 }, 819 }, 820 }, 821 xdr.OperationResult{ 822 Code: xdr.OperationResultCodeOpInner, 823 Tr: &xdr.OperationResultTr{ 824 Type: xdr.OperationTypeRevokeSponsorship, 825 RevokeSponsorshipResult: &xdr.RevokeSponsorshipResult{ 826 Code: xdr.RevokeSponsorshipResultCodeRevokeSponsorshipSuccess, 827 }, 828 }, 829 }, 830 xdr.OperationResult{ 831 Code: xdr.OperationResultCodeOpInner, 832 Tr: &xdr.OperationResultTr{ 833 Type: xdr.OperationTypeRevokeSponsorship, 834 RevokeSponsorshipResult: &xdr.RevokeSponsorshipResult{ 835 Code: xdr.RevokeSponsorshipResultCodeRevokeSponsorshipSuccess, 836 }, 837 }, 838 }, 839 xdr.OperationResult{ 840 Code: xdr.OperationResultCodeOpInner, 841 Tr: &xdr.OperationResultTr{ 842 Type: xdr.OperationTypeRevokeSponsorship, 843 RevokeSponsorshipResult: &xdr.RevokeSponsorshipResult{ 844 Code: xdr.RevokeSponsorshipResultCodeRevokeSponsorshipSuccess, 845 }, 846 }, 847 }, 848 xdr.OperationResult{ 849 Code: xdr.OperationResultCodeOpInner, 850 Tr: &xdr.OperationResultTr{ 851 Type: xdr.OperationTypeRevokeSponsorship, 852 RevokeSponsorshipResult: &xdr.RevokeSponsorshipResult{ 853 Code: xdr.RevokeSponsorshipResultCodeRevokeSponsorshipSuccess, 854 }, 855 }, 856 }, 857 xdr.OperationResult{ 858 Code: xdr.OperationResultCodeOpInner, 859 Tr: &xdr.OperationResultTr{ 860 Type: xdr.OperationTypeRevokeSponsorship, 861 RevokeSponsorshipResult: &xdr.RevokeSponsorshipResult{ 862 Code: xdr.RevokeSponsorshipResultCodeRevokeSponsorshipSuccess, 863 }, 864 }, 865 }, 866 xdr.OperationResult{ 867 Code: xdr.OperationResultCodeOpInner, 868 Tr: &xdr.OperationResultTr{ 869 Type: xdr.OperationTypeClawback, 870 ClawbackResult: &xdr.ClawbackResult{ 871 Code: xdr.ClawbackResultCodeClawbackSuccess, 872 }, 873 }, 874 }, 875 xdr.OperationResult{ 876 Code: xdr.OperationResultCodeOpInner, 877 Tr: &xdr.OperationResultTr{ 878 Type: xdr.OperationTypeClawbackClaimableBalance, 879 ClawbackClaimableBalanceResult: &xdr.ClawbackClaimableBalanceResult{ 880 Code: xdr.ClawbackClaimableBalanceResultCodeClawbackClaimableBalanceSuccess, 881 }, 882 }, 883 }, 884 xdr.OperationResult{ 885 Code: xdr.OperationResultCodeOpInner, 886 Tr: &xdr.OperationResultTr{ 887 Type: xdr.OperationTypeSetTrustLineFlags, 888 SetTrustLineFlagsResult: &xdr.SetTrustLineFlagsResult{ 889 Code: xdr.SetTrustLineFlagsResultCodeSetTrustLineFlagsSuccess, 890 }, 891 }, 892 }, 893 xdr.OperationResult{ 894 Code: xdr.OperationResultCodeOpInner, 895 Tr: &xdr.OperationResultTr{ 896 Type: xdr.OperationTypeLiquidityPoolDeposit, 897 LiquidityPoolDepositResult: &xdr.LiquidityPoolDepositResult{ 898 Code: xdr.LiquidityPoolDepositResultCodeLiquidityPoolDepositSuccess, 899 }, 900 }, 901 }, 902 xdr.OperationResult{ 903 Code: xdr.OperationResultCodeOpInner, 904 Tr: &xdr.OperationResultTr{ 905 Type: xdr.OperationTypeLiquidityPoolWithdraw, 906 LiquidityPoolWithdrawResult: &xdr.LiquidityPoolWithdrawResult{ 907 Code: xdr.LiquidityPoolWithdrawResultCodeLiquidityPoolWithdrawSuccess, 908 }, 909 }, 910 }, 911 //xdr.OperationResult{}, 912 //xdr.OperationResult{}, 913 //xdr.OperationResult{}, 914 //xdr.OperationResult{}, 915 //xdr.OperationResult{}, 916 //xdr.OperationResult{}, 917 } 918 inputTransaction.Result.Result.Result.Results = &results 919 inputTransaction.Envelope.V1 = &inputEnvelope 920 return 921 } 922 923 func makeOperationTestOutputs() (transformedOperations []OperationOutput) { 924 hardCodedSourceAccountAddress := testAccount3Address 925 hardCodedDestAccountAddress := testAccount4Address 926 hardCodedLedgerClose := genericCloseTime.UTC() 927 transformedOperations = []OperationOutput{ 928 OperationOutput{ 929 SourceAccount: hardCodedSourceAccountAddress, 930 Type: 0, 931 TypeString: "create_account", 932 TransactionID: 4096, 933 OperationID: 4097, 934 OperationDetails: map[string]interface{}{ 935 "account": hardCodedDestAccountAddress, 936 "funder": hardCodedSourceAccountAddress, 937 "starting_balance": 2.5, 938 }, 939 ClosedAt: hardCodedLedgerClose, 940 OperationResultCode: "OperationResultCodeOpInner", 941 OperationTraceCode: "CreateAccountResultCodeCreateAccountSuccess", 942 }, 943 OperationOutput{ 944 Type: 1, 945 TypeString: "payment", 946 SourceAccount: hardCodedSourceAccountAddress, 947 TransactionID: 4096, 948 OperationID: 4098, 949 OperationDetails: map[string]interface{}{ 950 "from": hardCodedSourceAccountAddress, 951 "to": hardCodedDestAccountAddress, 952 "amount": 35.0, 953 "asset_code": "USDT", 954 "asset_type": "credit_alphanum4", 955 "asset_issuer": hardCodedDestAccountAddress, 956 "asset_id": int64(-8205667356306085451), 957 }, 958 ClosedAt: hardCodedLedgerClose, 959 OperationResultCode: "OperationResultCodeOpInner", 960 OperationTraceCode: "PaymentResultCodePaymentSuccess", 961 }, 962 OperationOutput{ 963 Type: 1, 964 TypeString: "payment", 965 SourceAccount: hardCodedSourceAccountAddress, 966 TransactionID: 4096, 967 OperationID: 4099, 968 OperationDetails: map[string]interface{}{ 969 "from": hardCodedSourceAccountAddress, 970 "to": hardCodedDestAccountAddress, 971 "amount": 35.0, 972 "asset_type": "native", 973 "asset_id": int64(-5706705804583548011), 974 }, 975 ClosedAt: hardCodedLedgerClose, 976 OperationResultCode: "OperationResultCodeOpInner", 977 OperationTraceCode: "PaymentResultCodePaymentSuccess", 978 }, 979 OperationOutput{ 980 Type: 2, 981 TypeString: "path_payment_strict_receive", 982 SourceAccount: hardCodedSourceAccountAddress, 983 TransactionID: 4096, 984 OperationID: 4100, 985 OperationDetails: map[string]interface{}{ 986 "from": hardCodedSourceAccountAddress, 987 "to": hardCodedDestAccountAddress, 988 "source_amount": 894.6764349, 989 "source_max": 895.14959, 990 "amount": 895.14959, 991 "source_asset_type": "native", 992 "source_asset_id": int64(-5706705804583548011), 993 "asset_type": "native", 994 "asset_id": int64(-5706705804583548011), 995 "path": []Path{usdtAssetPath}, 996 }, 997 ClosedAt: hardCodedLedgerClose, 998 OperationResultCode: "OperationResultCodeOpInner", 999 OperationTraceCode: "PathPaymentStrictReceiveResultCodePathPaymentStrictReceiveSuccess", 1000 }, 1001 OperationOutput{ 1002 Type: 3, 1003 TypeString: "manage_sell_offer", 1004 SourceAccount: hardCodedSourceAccountAddress, 1005 TransactionID: 4096, 1006 OperationID: 4101, 1007 OperationDetails: map[string]interface{}{ 1008 "price": 0.514092, 1009 "amount": 76.586, 1010 "offer_id": int64(0.0), 1011 "price_r": Price{ 1012 Numerator: 128523, 1013 Denominator: 250000, 1014 }, 1015 "selling_asset_code": "USDT", 1016 "selling_asset_type": "credit_alphanum4", 1017 "selling_asset_issuer": hardCodedDestAccountAddress, 1018 "selling_asset_id": int64(-8205667356306085451), 1019 "buying_asset_type": "native", 1020 "buying_asset_id": int64(-5706705804583548011), 1021 }, 1022 ClosedAt: hardCodedLedgerClose, 1023 OperationResultCode: "OperationResultCodeOpInner", 1024 OperationTraceCode: "ManageSellOfferResultCodeManageSellOfferSuccess", 1025 }, 1026 OperationOutput{ 1027 Type: 4, 1028 TypeString: "create_passive_sell_offer", 1029 SourceAccount: hardCodedSourceAccountAddress, 1030 TransactionID: 4096, 1031 OperationID: 4102, 1032 OperationDetails: map[string]interface{}{ 1033 "amount": 63.1595, 1034 "price": 0.0791606, 1035 "price_r": Price{ 1036 Numerator: 99583200, 1037 Denominator: 1257990000, 1038 }, 1039 "buying_asset_code": "USDT", 1040 "buying_asset_type": "credit_alphanum4", 1041 "buying_asset_issuer": hardCodedDestAccountAddress, 1042 "buying_asset_id": int64(-8205667356306085451), 1043 "selling_asset_type": "native", 1044 "selling_asset_id": int64(-5706705804583548011), 1045 }, 1046 ClosedAt: hardCodedLedgerClose, 1047 OperationResultCode: "OperationResultCodeOpInner", 1048 OperationTraceCode: "ManageSellOfferResultCodeManageSellOfferSuccess", 1049 }, 1050 OperationOutput{ 1051 Type: 5, 1052 TypeString: "set_options", 1053 SourceAccount: hardCodedSourceAccountAddress, 1054 TransactionID: 4096, 1055 OperationID: 4103, 1056 OperationDetails: map[string]interface{}{ 1057 "inflation_dest": hardCodedDestAccountAddress, 1058 "clear_flags": []int32{1, 2}, 1059 "clear_flags_s": []string{"auth_required", "auth_revocable"}, 1060 "set_flags": []int32{4}, 1061 "set_flags_s": []string{"auth_immutable"}, 1062 "master_key_weight": uint32(3), 1063 "low_threshold": uint32(1), 1064 "med_threshold": uint32(3), 1065 "high_threshold": uint32(5), 1066 "home_domain": "2019=DRA;n-test", 1067 "signer_key": "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF", 1068 "signer_weight": uint32(1), 1069 }, 1070 ClosedAt: hardCodedLedgerClose, 1071 OperationResultCode: "OperationResultCodeOpInner", 1072 OperationTraceCode: "SetOptionsResultCodeSetOptionsSuccess", 1073 }, 1074 OperationOutput{ 1075 Type: 6, 1076 TypeString: "change_trust", 1077 SourceAccount: hardCodedSourceAccountAddress, 1078 TransactionID: 4096, 1079 OperationID: 4104, 1080 OperationDetails: map[string]interface{}{ 1081 "trustor": hardCodedSourceAccountAddress, 1082 "trustee": hardCodedDestAccountAddress, 1083 "limit": 50000000000.0, 1084 "asset_code": "USSD", 1085 "asset_type": "credit_alphanum4", 1086 "asset_issuer": hardCodedDestAccountAddress, 1087 "asset_id": int64(6690054458235693884), 1088 }, 1089 ClosedAt: hardCodedLedgerClose, 1090 OperationResultCode: "OperationResultCodeOpInner", 1091 OperationTraceCode: "ChangeTrustResultCodeChangeTrustSuccess", 1092 }, 1093 OperationOutput{ 1094 Type: 6, 1095 TypeString: "change_trust", 1096 SourceAccount: hardCodedSourceAccountAddress, 1097 TransactionID: 4096, 1098 OperationID: 4105, 1099 OperationDetails: map[string]interface{}{ 1100 "trustor": hardCodedSourceAccountAddress, 1101 "limit": 50000000000.0, 1102 "asset_type": "liquidity_pool_shares", 1103 "liquidity_pool_id": "185a6b384c651552ba09b32851b79f5f6ab61e80883d303f52bea1406a4923f0", 1104 }, 1105 ClosedAt: hardCodedLedgerClose, 1106 OperationResultCode: "OperationResultCodeOpInner", 1107 OperationTraceCode: "ChangeTrustResultCodeChangeTrustSuccess", 1108 }, 1109 OperationOutput{ 1110 Type: 7, 1111 TypeString: "allow_trust", 1112 SourceAccount: hardCodedSourceAccountAddress, 1113 TransactionID: 4096, 1114 OperationID: 4106, 1115 OperationDetails: map[string]interface{}{ 1116 "trustee": hardCodedSourceAccountAddress, 1117 "trustor": hardCodedDestAccountAddress, 1118 "authorize": true, 1119 "asset_code": "USDT", 1120 "asset_type": "credit_alphanum4", 1121 "asset_issuer": hardCodedSourceAccountAddress, 1122 "asset_id": int64(8485542065083974675), 1123 }, 1124 ClosedAt: hardCodedLedgerClose, 1125 OperationResultCode: "OperationResultCodeOpInner", 1126 OperationTraceCode: "AllowTrustResultCodeAllowTrustSuccess", 1127 }, 1128 OperationOutput{ 1129 Type: 8, 1130 TypeString: "account_merge", 1131 SourceAccount: hardCodedSourceAccountAddress, 1132 TransactionID: 4096, 1133 OperationID: 4107, 1134 OperationDetails: map[string]interface{}{ 1135 "account": hardCodedSourceAccountAddress, 1136 "into": hardCodedDestAccountAddress, 1137 }, 1138 ClosedAt: hardCodedLedgerClose, 1139 OperationResultCode: "OperationResultCodeOpInner", 1140 OperationTraceCode: "AccountMergeResultCodeAccountMergeSuccess", 1141 }, 1142 OperationOutput{ 1143 Type: 9, 1144 TypeString: "inflation", 1145 SourceAccount: hardCodedSourceAccountAddress, 1146 TransactionID: 4096, 1147 OperationID: 4108, 1148 OperationDetails: map[string]interface{}{}, 1149 ClosedAt: hardCodedLedgerClose, 1150 OperationResultCode: "OperationResultCodeOpInner", 1151 OperationTraceCode: "InflationResultCodeInflationSuccess", 1152 }, 1153 OperationOutput{ 1154 Type: 10, 1155 TypeString: "manage_data", 1156 SourceAccount: hardCodedSourceAccountAddress, 1157 TransactionID: 4096, 1158 OperationID: 4109, 1159 OperationDetails: map[string]interface{}{ 1160 "name": "test", 1161 "value": base64.StdEncoding.EncodeToString([]byte{0x76, 0x61, 0x6c, 0x75, 0x65}), 1162 }, 1163 ClosedAt: hardCodedLedgerClose, 1164 OperationResultCode: "OperationResultCodeOpInner", 1165 OperationTraceCode: "ManageDataResultCodeManageDataSuccess", 1166 }, 1167 OperationOutput{ 1168 Type: 11, 1169 TypeString: "bump_sequence", 1170 SourceAccount: hardCodedSourceAccountAddress, 1171 TransactionID: 4096, 1172 OperationID: 4110, 1173 OperationDetails: map[string]interface{}{ 1174 "bump_to": "100", 1175 }, 1176 ClosedAt: hardCodedLedgerClose, 1177 OperationResultCode: "OperationResultCodeOpInner", 1178 OperationTraceCode: "BumpSequenceResultCodeBumpSequenceSuccess", 1179 }, 1180 OperationOutput{ 1181 Type: 12, 1182 TypeString: "manage_buy_offer", 1183 SourceAccount: hardCodedSourceAccountAddress, 1184 TransactionID: 4096, 1185 OperationID: 4111, 1186 OperationDetails: map[string]interface{}{ 1187 "price": 0.3496823, 1188 "amount": 765.4501001, 1189 "price_r": Price{ 1190 Numerator: 635863285, 1191 Denominator: 1818402817, 1192 }, 1193 "selling_asset_code": "USDT", 1194 "selling_asset_type": "credit_alphanum4", 1195 "selling_asset_issuer": hardCodedDestAccountAddress, 1196 "selling_asset_id": int64(-8205667356306085451), 1197 "buying_asset_type": "native", 1198 "buying_asset_id": int64(-5706705804583548011), 1199 "offer_id": int64(100), 1200 }, 1201 ClosedAt: hardCodedLedgerClose, 1202 OperationResultCode: "OperationResultCodeOpInner", 1203 OperationTraceCode: "ManageBuyOfferResultCodeManageBuyOfferSuccess", 1204 }, 1205 OperationOutput{ 1206 Type: 13, 1207 TypeString: "path_payment_strict_send", 1208 SourceAccount: hardCodedSourceAccountAddress, 1209 TransactionID: 4096, 1210 OperationID: 4112, 1211 OperationDetails: map[string]interface{}{ 1212 "from": hardCodedSourceAccountAddress, 1213 "to": hardCodedDestAccountAddress, 1214 "source_amount": 0.1598182, 1215 "destination_min": "428.0460538", 1216 "amount": 433.4043858, 1217 "path": []Path{usdtAssetPath}, 1218 "source_asset_type": "native", 1219 "source_asset_id": int64(-5706705804583548011), 1220 "asset_type": "native", 1221 "asset_id": int64(-5706705804583548011), 1222 }, 1223 ClosedAt: hardCodedLedgerClose, 1224 OperationResultCode: "OperationResultCodeOpInner", 1225 OperationTraceCode: "PathPaymentStrictSendResultCodePathPaymentStrictSendSuccess", 1226 }, 1227 OperationOutput{ 1228 Type: 14, 1229 TypeString: "create_claimable_balance", 1230 SourceAccount: hardCodedSourceAccountAddress, 1231 TransactionID: 4096, 1232 OperationID: 4113, 1233 OperationDetails: map[string]interface{}{ 1234 "asset": "USDT:GBVVRXLMNCJQW3IDDXC3X6XCH35B5Q7QXNMMFPENSOGUPQO7WO7HGZPA", 1235 "amount": 123456.789, 1236 "claimants": []Claimant{testClaimantDetails}, 1237 }, 1238 ClosedAt: hardCodedLedgerClose, 1239 OperationResultCode: "OperationResultCodeOpInner", 1240 OperationTraceCode: "CreateClaimableBalanceResultCodeCreateClaimableBalanceSuccess", 1241 }, 1242 OperationOutput{ 1243 Type: 15, 1244 TypeString: "claim_claimable_balance", 1245 SourceAccount: testAccount3Address, 1246 TransactionID: 4096, 1247 OperationID: 4114, 1248 OperationDetails: map[string]interface{}{ 1249 "claimant": hardCodedSourceAccountAddress, 1250 "balance_id": "000000000102030405060708090000000000000000000000000000000000000000000000", 1251 }, 1252 ClosedAt: hardCodedLedgerClose, 1253 OperationResultCode: "OperationResultCodeOpInner", 1254 OperationTraceCode: "ClaimClaimableBalanceResultCodeClaimClaimableBalanceSuccess", 1255 }, 1256 OperationOutput{ 1257 Type: 16, 1258 TypeString: "begin_sponsoring_future_reserves", 1259 SourceAccount: hardCodedSourceAccountAddress, 1260 TransactionID: 4096, 1261 OperationID: 4115, 1262 OperationDetails: map[string]interface{}{ 1263 "sponsored_id": hardCodedDestAccountAddress, 1264 }, 1265 ClosedAt: hardCodedLedgerClose, 1266 OperationResultCode: "OperationResultCodeOpInner", 1267 OperationTraceCode: "BeginSponsoringFutureReservesResultCodeBeginSponsoringFutureReservesSuccess", 1268 }, 1269 OperationOutput{ 1270 Type: 18, 1271 TypeString: "revoke_sponsorship", 1272 SourceAccount: hardCodedSourceAccountAddress, 1273 TransactionID: 4096, 1274 OperationID: 4116, 1275 OperationDetails: map[string]interface{}{ 1276 "signer_account_id": hardCodedDestAccountAddress, 1277 "signer_key": "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF", 1278 }, 1279 ClosedAt: hardCodedLedgerClose, 1280 OperationResultCode: "OperationResultCodeOpInner", 1281 OperationTraceCode: "RevokeSponsorshipResultCodeRevokeSponsorshipSuccess", 1282 }, 1283 OperationOutput{ 1284 Type: 18, 1285 TypeString: "revoke_sponsorship", 1286 SourceAccount: hardCodedSourceAccountAddress, 1287 TransactionID: 4096, 1288 OperationID: 4117, 1289 OperationDetails: map[string]interface{}{ 1290 "account_id": hardCodedDestAccountAddress, 1291 }, 1292 ClosedAt: hardCodedLedgerClose, 1293 OperationResultCode: "OperationResultCodeOpInner", 1294 OperationTraceCode: "RevokeSponsorshipResultCodeRevokeSponsorshipSuccess", 1295 }, 1296 OperationOutput{ 1297 Type: 18, 1298 TypeString: "revoke_sponsorship", 1299 SourceAccount: hardCodedSourceAccountAddress, 1300 TransactionID: 4096, 1301 OperationID: 4118, 1302 OperationDetails: map[string]interface{}{ 1303 "claimable_balance_id": "000000000102030405060708090000000000000000000000000000000000000000000000", 1304 }, 1305 ClosedAt: hardCodedLedgerClose, 1306 OperationResultCode: "OperationResultCodeOpInner", 1307 OperationTraceCode: "RevokeSponsorshipResultCodeRevokeSponsorshipSuccess", 1308 }, 1309 OperationOutput{ 1310 Type: 18, 1311 TypeString: "revoke_sponsorship", 1312 SourceAccount: hardCodedSourceAccountAddress, 1313 TransactionID: 4096, 1314 OperationID: 4119, 1315 OperationDetails: map[string]interface{}{ 1316 "data_account_id": hardCodedDestAccountAddress, 1317 "data_name": "test", 1318 }, 1319 ClosedAt: hardCodedLedgerClose, 1320 OperationResultCode: "OperationResultCodeOpInner", 1321 OperationTraceCode: "RevokeSponsorshipResultCodeRevokeSponsorshipSuccess", 1322 }, 1323 OperationOutput{ 1324 Type: 18, 1325 TypeString: "revoke_sponsorship", 1326 SourceAccount: hardCodedSourceAccountAddress, 1327 TransactionID: 4096, 1328 OperationID: 4120, 1329 OperationDetails: map[string]interface{}{ 1330 "offer_id": int64(100), 1331 }, 1332 ClosedAt: hardCodedLedgerClose, 1333 OperationResultCode: "OperationResultCodeOpInner", 1334 OperationTraceCode: "RevokeSponsorshipResultCodeRevokeSponsorshipSuccess", 1335 }, 1336 OperationOutput{ 1337 Type: 18, 1338 TypeString: "revoke_sponsorship", 1339 SourceAccount: hardCodedSourceAccountAddress, 1340 TransactionID: 4096, 1341 OperationID: 4121, 1342 OperationDetails: map[string]interface{}{ 1343 "trustline_account_id": testAccount3Address, 1344 "trustline_asset": "USTT:GBT4YAEGJQ5YSFUMNKX6BPBUOCPNAIOFAVZOF6MIME2CECBMEIUXFZZN", 1345 }, 1346 ClosedAt: hardCodedLedgerClose, 1347 OperationResultCode: "OperationResultCodeOpInner", 1348 OperationTraceCode: "RevokeSponsorshipResultCodeRevokeSponsorshipSuccess", 1349 }, 1350 OperationOutput{ 1351 Type: 18, 1352 TypeString: "revoke_sponsorship", 1353 SourceAccount: hardCodedSourceAccountAddress, 1354 TransactionID: 4096, 1355 OperationID: 4122, 1356 OperationDetails: map[string]interface{}{ 1357 "liquidity_pool_id": "0102030405060708090000000000000000000000000000000000000000000000", 1358 }, 1359 ClosedAt: hardCodedLedgerClose, 1360 OperationResultCode: "OperationResultCodeOpInner", 1361 OperationTraceCode: "RevokeSponsorshipResultCodeRevokeSponsorshipSuccess", 1362 }, 1363 OperationOutput{ 1364 Type: 19, 1365 TypeString: "clawback", 1366 SourceAccount: hardCodedSourceAccountAddress, 1367 TransactionID: 4096, 1368 OperationID: 4123, 1369 OperationDetails: map[string]interface{}{ 1370 "from": hardCodedDestAccountAddress, 1371 "amount": 0.1598182, 1372 "asset_code": "USDT", 1373 "asset_issuer": "GBVVRXLMNCJQW3IDDXC3X6XCH35B5Q7QXNMMFPENSOGUPQO7WO7HGZPA", 1374 "asset_type": "credit_alphanum4", 1375 "asset_id": int64(-8205667356306085451), 1376 }, 1377 ClosedAt: hardCodedLedgerClose, 1378 OperationResultCode: "OperationResultCodeOpInner", 1379 OperationTraceCode: "ClawbackResultCodeClawbackSuccess", 1380 }, 1381 OperationOutput{ 1382 Type: 20, 1383 TypeString: "clawback_claimable_balance", 1384 SourceAccount: hardCodedSourceAccountAddress, 1385 TransactionID: 4096, 1386 OperationID: 4124, 1387 OperationDetails: map[string]interface{}{ 1388 "balance_id": "000000000102030405060708090000000000000000000000000000000000000000000000", 1389 }, 1390 ClosedAt: hardCodedLedgerClose, 1391 OperationResultCode: "OperationResultCodeOpInner", 1392 OperationTraceCode: "ClawbackClaimableBalanceResultCodeClawbackClaimableBalanceSuccess", 1393 }, 1394 OperationOutput{ 1395 Type: 21, 1396 TypeString: "set_trust_line_flags", 1397 SourceAccount: hardCodedSourceAccountAddress, 1398 TransactionID: 4096, 1399 OperationID: 4125, 1400 OperationDetails: map[string]interface{}{ 1401 "asset_code": "USDT", 1402 "asset_issuer": "GBVVRXLMNCJQW3IDDXC3X6XCH35B5Q7QXNMMFPENSOGUPQO7WO7HGZPA", 1403 "asset_type": "credit_alphanum4", 1404 "asset_id": int64(-8205667356306085451), 1405 "trustor": testAccount4Address, 1406 "clear_flags": []int32{1, 2}, 1407 "clear_flags_s": []string{"authorized", "authorized_to_maintain_liabilities"}, 1408 "set_flags": []int32{4}, 1409 "set_flags_s": []string{"clawback_enabled"}, 1410 }, 1411 ClosedAt: hardCodedLedgerClose, 1412 OperationResultCode: "OperationResultCodeOpInner", 1413 OperationTraceCode: "SetTrustLineFlagsResultCodeSetTrustLineFlagsSuccess", 1414 }, 1415 OperationOutput{ 1416 Type: 22, 1417 TypeString: "liquidity_pool_deposit", 1418 SourceAccount: hardCodedSourceAccountAddress, 1419 TransactionID: 4096, 1420 OperationID: 4126, 1421 OperationDetails: map[string]interface{}{ 1422 "liquidity_pool_id": "0102030405060708090000000000000000000000000000000000000000000000", 1423 "reserve_a_asset_type": "native", 1424 "reserve_a_asset_id": int64(-5706705804583548011), 1425 "reserve_a_max_amount": 0.0001, 1426 "reserve_a_deposit_amount": 0.0001, 1427 "reserve_b_asset_type": "credit_alphanum4", 1428 "reserve_b_asset_code": "USSD", 1429 "reserve_b_asset_issuer": "GBVVRXLMNCJQW3IDDXC3X6XCH35B5Q7QXNMMFPENSOGUPQO7WO7HGZPA", 1430 "reserve_b_asset_id": int64(6690054458235693884), 1431 "reserve_b_deposit_amount": 0.00001, 1432 "reserve_b_max_amount": 0.00001, 1433 "max_price": 1000000.0000000, 1434 "max_price_r": Price{ 1435 Numerator: 1000000, 1436 Denominator: 1, 1437 }, 1438 "min_price": 0.0000010, 1439 "min_price_r": Price{ 1440 Numerator: 1, 1441 Denominator: 1000000, 1442 }, 1443 "shares_received": 0.0000002, 1444 }, 1445 ClosedAt: hardCodedLedgerClose, 1446 OperationResultCode: "OperationResultCodeOpInner", 1447 OperationTraceCode: "LiquidityPoolDepositResultCodeLiquidityPoolDepositSuccess", 1448 }, 1449 OperationOutput{ 1450 Type: 23, 1451 TypeString: "liquidity_pool_withdraw", 1452 SourceAccount: hardCodedSourceAccountAddress, 1453 TransactionID: 4096, 1454 OperationID: 4127, 1455 OperationDetails: map[string]interface{}{ 1456 "liquidity_pool_id": "0102030405060708090000000000000000000000000000000000000000000000", 1457 "reserve_a_asset_type": "native", 1458 "reserve_a_asset_id": int64(-5706705804583548011), 1459 "reserve_a_min_amount": 0.0000001, 1460 "reserve_a_withdraw_amount": -0.0001, 1461 "reserve_b_asset_type": "credit_alphanum4", 1462 "reserve_b_asset_code": "USSD", 1463 "reserve_b_asset_issuer": "GBVVRXLMNCJQW3IDDXC3X6XCH35B5Q7QXNMMFPENSOGUPQO7WO7HGZPA", 1464 "reserve_b_asset_id": int64(6690054458235693884), 1465 "reserve_b_withdraw_amount": -0.00001, 1466 "reserve_b_min_amount": 0.0000001, 1467 "shares": 0.0000004, 1468 }, 1469 ClosedAt: hardCodedLedgerClose, 1470 OperationResultCode: "OperationResultCodeOpInner", 1471 OperationTraceCode: "LiquidityPoolWithdrawResultCodeLiquidityPoolWithdrawSuccess", 1472 }, 1473 //OperationOutput{ 1474 // Type: 24, 1475 // TypeString: "invoke_host_function", 1476 // SourceAccount: hardCodedSourceAccountAddress, 1477 // TransactionID: 4096, 1478 // OperationID: 4128, 1479 // OperationDetails: map[string]interface{}{ 1480 // "function": "HostFunctionTypeHostFunctionTypeInvokeContract", 1481 // "type": "invoke_contract", 1482 // "contract_id": "", 1483 // "contract_code_hash": "", 1484 // "asset_balance_changes": []map[string]interface{}{}, 1485 // }, 1486 // ClosedAt: hardCodedLedgerClose, 1487 //}, 1488 //OperationOutput{ 1489 // Type: 24, 1490 // TypeString: "invoke_host_function", 1491 // SourceAccount: hardCodedSourceAccountAddress, 1492 // TransactionID: 4096, 1493 // OperationID: 4129, 1494 // OperationDetails: map[string]interface{}{ 1495 // "function": "HostFunctionTypeHostFunctionTypeCreateContract", 1496 // "type": "create_contract", 1497 // "contract_id": "", 1498 // "contract_code_hash": "", 1499 // "from": "address", 1500 // "address": "", 1501 // }, 1502 // ClosedAt: hardCodedLedgerClose, 1503 //}, 1504 //OperationOutput{ 1505 // Type: 24, 1506 // TypeString: "invoke_host_function", 1507 // SourceAccount: hardCodedSourceAccountAddress, 1508 // TransactionID: 4096, 1509 // OperationID: 4130, 1510 // OperationDetails: map[string]interface{}{ 1511 // "function": "HostFunctionTypeHostFunctionTypeCreateContract", 1512 // "type": "create_contract", 1513 // "contract_id": "", 1514 // "contract_code_hash": "", 1515 // "from": "asset", 1516 // "asset": "", 1517 // }, 1518 // ClosedAt: hardCodedLedgerClose, 1519 //}, 1520 //OperationOutput{ 1521 // Type: 24, 1522 // TypeString: "invoke_host_function", 1523 // SourceAccount: hardCodedSourceAccountAddress, 1524 // TransactionID: 4096, 1525 // OperationID: 4131, 1526 // OperationDetails: map[string]interface{}{ 1527 // "function": "HostFunctionTypeHostFunctionTypeUploadContractWasm", 1528 // "type": "upload_wasm", 1529 // "contract_code_hash": "", 1530 // }, 1531 // ClosedAt: hardCodedLedgerClose, 1532 //}, 1533 //OperationOutput{ 1534 // Type: 25, 1535 // TypeString: "bump_footprint_expiration", 1536 // SourceAccount: hardCodedSourceAccountAddress, 1537 // TransactionID: 4096, 1538 // OperationID: 4132, 1539 // OperationDetails: map[string]interface{}{ 1540 // "type": "bump_footprint_expiration", 1541 // "ledgers_to_expire": 1234, 1542 // "contract_id": "", 1543 // "contract_code_hash": "", 1544 // }, 1545 // ClosedAt: hardCodedLedgerClose, 1546 //}, 1547 //OperationOutput{ 1548 // Type: 26, 1549 // TypeString: "restore_footprint", 1550 // SourceAccount: hardCodedSourceAccountAddress, 1551 // TransactionID: 4096, 1552 // OperationID: 4133, 1553 // OperationDetails: map[string]interface{}{ 1554 // "type": "restore_footprint", 1555 // "contract_id": "", 1556 // "contract_code_hash": "", 1557 // }, 1558 // ClosedAt: hardCodedLedgerClose, 1559 //}, 1560 } 1561 return 1562 }