From f3d8c2abdeb1d2af79524a386faea7b7344bc0a4 Mon Sep 17 00:00:00 2001 From: Simon Chow Date: Mon, 16 Sep 2024 17:40:53 -0400 Subject: [PATCH] Support p22 changes --- go.mod | 2 +- go.sum | 4 +- internal/transform/operation.go | 176 +++++++----- internal/transform/operation_test.go | 406 +++++++++++++-------------- 4 files changed, 308 insertions(+), 280 deletions(-) diff --git a/go.mod b/go.mod index fa83ff3a..718ca4e8 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.17.0 - github.com/stellar/go v0.0.0-20240906064426-eb4b2ab750b8 + github.com/stellar/go v0.0.0-20240905180041-acfaa0686213 github.com/stretchr/testify v1.9.0 github.com/xitongsys/parquet-go v1.6.2 github.com/xitongsys/parquet-go-source v0.0.0-20240122235623-d6294584ab18 diff --git a/go.sum b/go.sum index b7a6f73f..d16de7d9 100644 --- a/go.sum +++ b/go.sum @@ -641,8 +641,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= -github.com/stellar/go v0.0.0-20240906064426-eb4b2ab750b8 h1:jbG9brYkKwfxB5yX4fKMzRodS8ZloF1HjPQWfj4oo+4= -github.com/stellar/go v0.0.0-20240906064426-eb4b2ab750b8/go.mod h1:rrFK7a8i2h9xad9HTfnSN/dTNEqXVHKAbkFeR7UxAgs= +github.com/stellar/go v0.0.0-20240905180041-acfaa0686213 h1:224VUCwV1xmmeTru1zCmTHxvi2RECoHdfdWgd9ni518= +github.com/stellar/go v0.0.0-20240905180041-acfaa0686213/go.mod h1:rrFK7a8i2h9xad9HTfnSN/dTNEqXVHKAbkFeR7UxAgs= github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 h1:OzCVd0SV5qE3ZcDeSFCmOWLZfEWZ3Oe8KtmSOYKEVWE= github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/internal/transform/operation.go b/internal/transform/operation.go index a3be4651..29d479f8 100644 --- a/internal/transform/operation.go +++ b/internal/transform/operation.go @@ -1029,8 +1029,6 @@ func extractOperationDetails(operation xdr.Operation, transaction ingest.LedgerT args = append(args, xdr.ScVal{Type: xdr.ScValTypeScvAddress, Address: &invokeArgs.ContractAddress}) args = append(args, xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &invokeArgs.FunctionName}) args = append(args, invokeArgs.Args...) - params := make([]map[string]string, 0, len(args)) - paramsDecoded := make([]map[string]string, 0, len(args)) details["type"] = "invoke_contract" @@ -1044,28 +1042,7 @@ func extractOperationDetails(operation xdr.Operation, transaction ingest.LedgerT details["contract_id"] = contractId details["contract_code_hash"] = contractCodeHashFromTxEnvelope(transactionEnvelope) - for _, param := range args { - serializedParam := map[string]string{} - serializedParam["value"] = "n/a" - serializedParam["type"] = "n/a" - - serializedParamDecoded := map[string]string{} - serializedParamDecoded["value"] = "n/a" - serializedParamDecoded["type"] = "n/a" - - if scValTypeName, ok := param.ArmForSwitch(int32(param.Type)); ok { - serializedParam["type"] = scValTypeName - serializedParamDecoded["type"] = scValTypeName - if raw, err := param.MarshalBinary(); err == nil { - serializedParam["value"] = base64.StdEncoding.EncodeToString(raw) - serializedParamDecoded["value"] = param.String() - } - } - params = append(params, serializedParam) - paramsDecoded = append(paramsDecoded, serializedParamDecoded) - } - details["parameters"] = params - details["parameters_decoded"] = paramsDecoded + details["parameters"], details["parameters_decoded"] = serializeParameters(args) if balanceChanges, err := parseAssetBalanceChangesFromContractEvents(transaction, network); err != nil { return nil, err @@ -1082,26 +1059,38 @@ func extractOperationDetails(operation xdr.Operation, transaction ingest.LedgerT details["contract_id"] = contractIdFromTxEnvelope(transactionEnvelope) details["contract_code_hash"] = contractCodeHashFromTxEnvelope(transactionEnvelope) - switch args.ContractIdPreimage.Type { - case xdr.ContractIdPreimageTypeContractIdPreimageFromAddress: - fromAddress := args.ContractIdPreimage.MustFromAddress() - address, err := fromAddress.Address.String() - if err != nil { - panic(fmt.Errorf("error obtaining address for: %s", args.ContractIdPreimage.Type)) + preimageTypeMap := switchContractIdPreimageType(args.ContractIdPreimage) + for key, val := range preimageTypeMap { + if _, ok := preimageTypeMap[key]; ok { + details[key] = val } - details["from"] = "address" - details["address"] = address - case xdr.ContractIdPreimageTypeContractIdPreimageFromAsset: - details["from"] = "asset" - details["asset"] = args.ContractIdPreimage.MustFromAsset().StringCanonical() - default: - panic(fmt.Errorf("unknown contract id type: %s", args.ContractIdPreimage.Type)) } case xdr.HostFunctionTypeHostFunctionTypeUploadContractWasm: details["type"] = "upload_wasm" transactionEnvelope := getTransactionV1Envelope(transaction.Envelope) details["ledger_key_hash"] = ledgerKeyHashFromTxEnvelope(transactionEnvelope) details["contract_code_hash"] = contractCodeHashFromTxEnvelope(transactionEnvelope) + case xdr.HostFunctionTypeHostFunctionTypeCreateContractV2: + args := op.HostFunction.MustCreateContractV2() + details["type"] = "create_contract_v2" + + transactionEnvelope := getTransactionV1Envelope(transaction.Envelope) + details["ledger_key_hash"] = ledgerKeyHashFromTxEnvelope(transactionEnvelope) + details["contract_id"] = contractIdFromTxEnvelope(transactionEnvelope) + details["contract_code_hash"] = contractCodeHashFromTxEnvelope(transactionEnvelope) + + // ConstructorArgs is a list of ScVals + // This will initially be handled the same as InvokeContractParams until a different + // model is found necessary. + constructorArgs := args.ConstructorArgs + details["parameters"], details["parameters_decoded"] = serializeParameters(constructorArgs) + + preimageTypeMap := switchContractIdPreimageType(args.ContractIdPreimage) + for key, val := range preimageTypeMap { + if _, ok := preimageTypeMap[key]; ok { + details[key] = val + } + } default: panic(fmt.Errorf("unknown host function type: %s", op.HostFunction.Type)) } @@ -1637,8 +1626,6 @@ func (operation *transactionOperationWrapper) Details() (map[string]interface{}, args = append(args, xdr.ScVal{Type: xdr.ScValTypeScvAddress, Address: &invokeArgs.ContractAddress}) args = append(args, xdr.ScVal{Type: xdr.ScValTypeScvSymbol, Sym: &invokeArgs.FunctionName}) args = append(args, invokeArgs.Args...) - params := make([]map[string]string, 0, len(args)) - paramsDecoded := make([]map[string]string, 0, len(args)) details["type"] = "invoke_contract" @@ -1652,28 +1639,7 @@ func (operation *transactionOperationWrapper) Details() (map[string]interface{}, details["contract_id"] = contractId details["contract_code_hash"] = contractCodeHashFromTxEnvelope(transactionEnvelope) - for _, param := range args { - serializedParam := map[string]string{} - serializedParam["value"] = "n/a" - serializedParam["type"] = "n/a" - - serializedParamDecoded := map[string]string{} - serializedParamDecoded["value"] = "n/a" - serializedParamDecoded["type"] = "n/a" - - if scValTypeName, ok := param.ArmForSwitch(int32(param.Type)); ok { - serializedParam["type"] = scValTypeName - serializedParamDecoded["type"] = scValTypeName - if raw, err := param.MarshalBinary(); err == nil { - serializedParam["value"] = base64.StdEncoding.EncodeToString(raw) - serializedParamDecoded["value"] = param.String() - } - } - params = append(params, serializedParam) - paramsDecoded = append(paramsDecoded, serializedParamDecoded) - } - details["parameters"] = params - details["parameters_decoded"] = paramsDecoded + details["parameters"], details["parameters_decoded"] = serializeParameters(args) if balanceChanges, err := operation.parseAssetBalanceChangesFromContractEvents(); err != nil { return nil, err @@ -1690,26 +1656,38 @@ func (operation *transactionOperationWrapper) Details() (map[string]interface{}, details["contract_id"] = contractIdFromTxEnvelope(transactionEnvelope) details["contract_code_hash"] = contractCodeHashFromTxEnvelope(transactionEnvelope) - switch args.ContractIdPreimage.Type { - case xdr.ContractIdPreimageTypeContractIdPreimageFromAddress: - fromAddress := args.ContractIdPreimage.MustFromAddress() - address, err := fromAddress.Address.String() - if err != nil { - panic(fmt.Errorf("error obtaining address for: %s", args.ContractIdPreimage.Type)) + preimageTypeMap := switchContractIdPreimageType(args.ContractIdPreimage) + for key, val := range preimageTypeMap { + if _, ok := preimageTypeMap[key]; ok { + details[key] = val } - details["from"] = "address" - details["address"] = address - case xdr.ContractIdPreimageTypeContractIdPreimageFromAsset: - details["from"] = "asset" - details["asset"] = args.ContractIdPreimage.MustFromAsset().StringCanonical() - default: - panic(fmt.Errorf("unknown contract id type: %s", args.ContractIdPreimage.Type)) } case xdr.HostFunctionTypeHostFunctionTypeUploadContractWasm: details["type"] = "upload_wasm" transactionEnvelope := getTransactionV1Envelope(operation.transaction.Envelope) details["ledger_key_hash"] = ledgerKeyHashFromTxEnvelope(transactionEnvelope) details["contract_code_hash"] = contractCodeHashFromTxEnvelope(transactionEnvelope) + case xdr.HostFunctionTypeHostFunctionTypeCreateContractV2: + args := op.HostFunction.MustCreateContractV2() + details["type"] = "create_contract_v2" + + transactionEnvelope := getTransactionV1Envelope(operation.transaction.Envelope) + details["ledger_key_hash"] = ledgerKeyHashFromTxEnvelope(transactionEnvelope) + details["contract_id"] = contractIdFromTxEnvelope(transactionEnvelope) + details["contract_code_hash"] = contractCodeHashFromTxEnvelope(transactionEnvelope) + + // ConstructorArgs is a list of ScVals + // This will initially be handled the same as InvokeContractParams until a different + // model is found necessary. + constructorArgs := args.ConstructorArgs + details["parameters"], details["parameters_decoded"] = serializeParameters(constructorArgs) + + preimageTypeMap := switchContractIdPreimageType(args.ContractIdPreimage) + for key, val := range preimageTypeMap { + if _, ok := preimageTypeMap[key]; ok { + details[key] = val + } + } default: panic(fmt.Errorf("unknown host function type: %s", op.HostFunction.Type)) } @@ -2175,3 +2153,53 @@ func dedupeParticipants(in []xdr.AccountId) (out []xdr.AccountId) { } return } + +func serializeParameters(args []xdr.ScVal) ([]map[string]string, []map[string]string) { + params := make([]map[string]string, 0, len(args)) + paramsDecoded := make([]map[string]string, 0, len(args)) + + for _, param := range args { + serializedParam := map[string]string{} + serializedParam["value"] = "n/a" + serializedParam["type"] = "n/a" + + serializedParamDecoded := map[string]string{} + serializedParamDecoded["value"] = "n/a" + serializedParamDecoded["type"] = "n/a" + + if scValTypeName, ok := param.ArmForSwitch(int32(param.Type)); ok { + serializedParam["type"] = scValTypeName + serializedParamDecoded["type"] = scValTypeName + if raw, err := param.MarshalBinary(); err == nil { + serializedParam["value"] = base64.StdEncoding.EncodeToString(raw) + serializedParamDecoded["value"] = param.String() + } + } + params = append(params, serializedParam) + paramsDecoded = append(paramsDecoded, serializedParamDecoded) + } + + return params, paramsDecoded +} + +func switchContractIdPreimageType(contractIdPreimage xdr.ContractIdPreimage) map[string]interface{} { + details := map[string]interface{}{} + + switch contractIdPreimage.Type { + case xdr.ContractIdPreimageTypeContractIdPreimageFromAddress: + fromAddress := contractIdPreimage.MustFromAddress() + address, err := fromAddress.Address.String() + if err != nil { + panic(fmt.Errorf("error obtaining address for: %s", contractIdPreimage.Type)) + } + details["from"] = "address" + details["address"] = address + case xdr.ContractIdPreimageTypeContractIdPreimageFromAsset: + details["from"] = "asset" + details["asset"] = contractIdPreimage.MustFromAsset().StringCanonical() + default: + panic(fmt.Errorf("unknown contract id type: %s", contractIdPreimage.Type)) + } + + return details +} diff --git a/internal/transform/operation_test.go b/internal/transform/operation_test.go index 1bb74865..29ee7181 100644 --- a/internal/transform/operation_test.go +++ b/internal/transform/operation_test.go @@ -102,11 +102,11 @@ func makeOperationTestInput() (inputTransaction ingest.LedgerTransaction, err er return } - //var wasm []byte - //var contractHash xdr.Hash - //var salt [32]byte - //var assetCode [12]byte - //var assetIssuer xdr.Uint256 + var wasm []byte + var contractHash xdr.Hash + var salt [32]byte + var assetCode [12]byte + var assetIssuer xdr.Uint256 hardCodedClearFlags := xdr.Uint32(3) hardCodedSetFlags := xdr.Uint32(4) @@ -515,111 +515,111 @@ func makeOperationTestInput() (inputTransaction ingest.LedgerTransaction, err er }, }, }, - //{ - // SourceAccount: nil, - // Body: xdr.OperationBody{ - // Type: xdr.OperationTypeInvokeHostFunction, - // InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ - // HostFunction: xdr.HostFunction{ - // Type: xdr.HostFunctionTypeHostFunctionTypeInvokeContract, - // InvokeContract: &xdr.InvokeContractArgs{ - // ContractAddress: xdr.ScAddress{ - // Type: xdr.ScAddressTypeScAddressTypeContract, - // ContractId: &contractHash, - // }, - // FunctionName: "test", - // Args: []xdr.ScVal{}, - // }, - // }, - // }, - // }, - //}, - //{ - // SourceAccount: nil, - // Body: xdr.OperationBody{ - // Type: xdr.OperationTypeInvokeHostFunction, - // InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ - // HostFunction: xdr.HostFunction{ - // Type: xdr.HostFunctionTypeHostFunctionTypeCreateContract, - // CreateContract: &xdr.CreateContractArgs{ - // ContractIdPreimage: xdr.ContractIdPreimage{ - // Type: xdr.ContractIdPreimageTypeContractIdPreimageFromAddress, - // FromAddress: &xdr.ContractIdPreimageFromAddress{ - // Address: xdr.ScAddress{ - // Type: xdr.ScAddressTypeScAddressTypeContract, - // ContractId: &contractHash, - // }, - // Salt: salt, - // }, - // }, - // Executable: xdr.ContractExecutable{}, - // }, - // }, - // }, - // }, - //}, - //{ - // SourceAccount: nil, - // Body: xdr.OperationBody{ - // Type: xdr.OperationTypeInvokeHostFunction, - // InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ - // HostFunction: xdr.HostFunction{ - // Type: xdr.HostFunctionTypeHostFunctionTypeCreateContract, - // CreateContract: &xdr.CreateContractArgs{ - // ContractIdPreimage: xdr.ContractIdPreimage{ - // Type: xdr.ContractIdPreimageTypeContractIdPreimageFromAsset, - // FromAsset: &xdr.Asset{ - // Type: xdr.AssetTypeAssetTypeCreditAlphanum12, - // AlphaNum12: &xdr.AlphaNum12{ - // AssetCode: assetCode, - // Issuer: xdr.AccountId{ - // Type: xdr.PublicKeyTypePublicKeyTypeEd25519, - // Ed25519: &assetIssuer, - // }, - // }, - // }, - // }, - // Executable: xdr.ContractExecutable{}, - // }, - // }, - // }, - // }, - //}, - //{ - // SourceAccount: nil, - // Body: xdr.OperationBody{ - // Type: xdr.OperationTypeInvokeHostFunction, - // InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ - // HostFunction: xdr.HostFunction{ - // Type: xdr.HostFunctionTypeHostFunctionTypeUploadContractWasm, - // Wasm: &wasm, - // }, - // }, - // }, - //}, - //{ - // SourceAccount: nil, - // Body: xdr.OperationBody{ - // Type: xdr.OperationTypeBumpFootprintExpiration, - // BumpFootprintExpirationOp: &xdr.BumpFootprintExpirationOp{ - // Ext: xdr.ExtensionPoint{ - // V: 0, - // }, - // LedgersToExpire: 1234, - // }, - // }, - //}, - //{ - // SourceAccount: nil, - // Body: xdr.OperationBody{ - // Type: xdr.OperationTypeRestoreFootprint, - // RestoreFootprintOp: &xdr.RestoreFootprintOp{ - // Ext: xdr.ExtensionPoint{ - // V: 0, - // }, - // }, - // }, - //}, + { + SourceAccount: nil, + Body: xdr.OperationBody{ + Type: xdr.OperationTypeInvokeHostFunction, + InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ + HostFunction: xdr.HostFunction{ + Type: xdr.HostFunctionTypeHostFunctionTypeInvokeContract, + InvokeContract: &xdr.InvokeContractArgs{ + ContractAddress: xdr.ScAddress{ + Type: xdr.ScAddressTypeScAddressTypeContract, + ContractId: &contractHash, + }, + FunctionName: "test", + Args: []xdr.ScVal{}, + }, + }, + }, + }, + }, + { + SourceAccount: nil, + Body: xdr.OperationBody{ + Type: xdr.OperationTypeInvokeHostFunction, + InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ + HostFunction: xdr.HostFunction{ + Type: xdr.HostFunctionTypeHostFunctionTypeCreateContract, + CreateContract: &xdr.CreateContractArgs{ + ContractIdPreimage: xdr.ContractIdPreimage{ + Type: xdr.ContractIdPreimageTypeContractIdPreimageFromAddress, + FromAddress: &xdr.ContractIdPreimageFromAddress{ + Address: xdr.ScAddress{ + Type: xdr.ScAddressTypeScAddressTypeContract, + ContractId: &contractHash, + }, + Salt: salt, + }, + }, + Executable: xdr.ContractExecutable{}, + }, + }, + }, + }, + }, + { + SourceAccount: nil, + Body: xdr.OperationBody{ + Type: xdr.OperationTypeInvokeHostFunction, + InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ + HostFunction: xdr.HostFunction{ + Type: xdr.HostFunctionTypeHostFunctionTypeCreateContract, + CreateContract: &xdr.CreateContractArgs{ + ContractIdPreimage: xdr.ContractIdPreimage{ + Type: xdr.ContractIdPreimageTypeContractIdPreimageFromAsset, + FromAsset: &xdr.Asset{ + Type: xdr.AssetTypeAssetTypeCreditAlphanum12, + AlphaNum12: &xdr.AlphaNum12{ + AssetCode: assetCode, + Issuer: xdr.AccountId{ + Type: xdr.PublicKeyTypePublicKeyTypeEd25519, + Ed25519: &assetIssuer, + }, + }, + }, + }, + Executable: xdr.ContractExecutable{}, + }, + }, + }, + }, + }, + { + SourceAccount: nil, + Body: xdr.OperationBody{ + Type: xdr.OperationTypeInvokeHostFunction, + InvokeHostFunctionOp: &xdr.InvokeHostFunctionOp{ + HostFunction: xdr.HostFunction{ + Type: xdr.HostFunctionTypeHostFunctionTypeUploadContractWasm, + Wasm: &wasm, + }, + }, + }, + }, + { + SourceAccount: nil, + Body: xdr.OperationBody{ + Type: xdr.OperationTypeExtendFootprintTtl, + ExtendFootprintTtlOp: &xdr.ExtendFootprintTtlOp{ + Ext: xdr.ExtensionPoint{ + V: 0, + }, + ExtendTo: 1234, + }, + }, + }, + { + SourceAccount: nil, + Body: xdr.OperationBody{ + Type: xdr.OperationTypeRestoreFootprint, + RestoreFootprintOp: &xdr.RestoreFootprintOp{ + Ext: xdr.ExtensionPoint{ + V: 0, + }, + }, + }, + }, } inputEnvelope.Tx.Operations = inputOperations results := []xdr.OperationResult{ @@ -909,12 +909,12 @@ func makeOperationTestInput() (inputTransaction ingest.LedgerTransaction, err er }, }, }, - //{}, - //{}, - //{}, - //{}, - //{}, - //{}, + {}, + {}, + {}, + {}, + {}, + {}, } inputTransaction.Result.Result.Result.Results = &results inputTransaction.Envelope.V1 = &inputEnvelope @@ -1737,93 +1737,93 @@ func makeOperationTestOutputs() (transformedOperations []OperationOutput) { "shares": 0.0000004, }, }, - //OperationOutput{ - // Type: 24, - // TypeString: "invoke_host_function", - // SourceAccount: hardCodedSourceAccountAddress, - // TransactionID: 4096, - // OperationID: 4128, - // OperationDetails: map[string]interface{}{ - // "function": "HostFunctionTypeHostFunctionTypeInvokeContract", - // "type": "invoke_contract", - // "contract_id": "", - // "contract_code_hash": "", - // "asset_balance_changes": []map[string]interface{}{}, - // }, - // ClosedAt: hardCodedLedgerClose, - //}, - //OperationOutput{ - // Type: 24, - // TypeString: "invoke_host_function", - // SourceAccount: hardCodedSourceAccountAddress, - // TransactionID: 4096, - // OperationID: 4129, - // OperationDetails: map[string]interface{}{ - // "function": "HostFunctionTypeHostFunctionTypeCreateContract", - // "type": "create_contract", - // "contract_id": "", - // "contract_code_hash": "", - // "from": "address", - // "address": "", - // }, - // ClosedAt: hardCodedLedgerClose, - //}, - //OperationOutput{ - // Type: 24, - // TypeString: "invoke_host_function", - // SourceAccount: hardCodedSourceAccountAddress, - // TransactionID: 4096, - // OperationID: 4130, - // OperationDetails: map[string]interface{}{ - // "function": "HostFunctionTypeHostFunctionTypeCreateContract", - // "type": "create_contract", - // "contract_id": "", - // "contract_code_hash": "", - // "from": "asset", - // "asset": "", - // }, - // ClosedAt: hardCodedLedgerClose, - //}, - //OperationOutput{ - // Type: 24, - // TypeString: "invoke_host_function", - // SourceAccount: hardCodedSourceAccountAddress, - // TransactionID: 4096, - // OperationID: 4131, - // OperationDetails: map[string]interface{}{ - // "function": "HostFunctionTypeHostFunctionTypeUploadContractWasm", - // "type": "upload_wasm", - // "contract_code_hash": "", - // }, - // ClosedAt: hardCodedLedgerClose, - //}, - //OperationOutput{ - // Type: 25, - // TypeString: "bump_footprint_expiration", - // SourceAccount: hardCodedSourceAccountAddress, - // TransactionID: 4096, - // OperationID: 4132, - // OperationDetails: map[string]interface{}{ - // "type": "bump_footprint_expiration", - // "ledgers_to_expire": 1234, - // "contract_id": "", - // "contract_code_hash": "", - // }, - // ClosedAt: hardCodedLedgerClose, - //}, - //OperationOutput{ - // Type: 26, - // TypeString: "restore_footprint", - // SourceAccount: hardCodedSourceAccountAddress, - // TransactionID: 4096, - // OperationID: 4133, - // OperationDetails: map[string]interface{}{ - // "type": "restore_footprint", - // "contract_id": "", - // "contract_code_hash": "", - // }, - // ClosedAt: hardCodedLedgerClose, - //}, + OperationOutput{ + Type: 24, + TypeString: "invoke_host_function", + SourceAccount: hardCodedSourceAccountAddress, + TransactionID: 4096, + OperationID: 4128, + OperationDetails: map[string]interface{}{ + "function": "HostFunctionTypeHostFunctionTypeInvokeContract", + "type": "invoke_contract", + "contract_id": "", + "contract_code_hash": "", + "asset_balance_changes": []map[string]interface{}{}, + }, + ClosedAt: hardCodedLedgerClose, + }, + OperationOutput{ + Type: 24, + TypeString: "invoke_host_function", + SourceAccount: hardCodedSourceAccountAddress, + TransactionID: 4096, + OperationID: 4129, + OperationDetails: map[string]interface{}{ + "function": "HostFunctionTypeHostFunctionTypeCreateContract", + "type": "create_contract", + "contract_id": "", + "contract_code_hash": "", + "from": "address", + "address": "", + }, + ClosedAt: hardCodedLedgerClose, + }, + OperationOutput{ + Type: 24, + TypeString: "invoke_host_function", + SourceAccount: hardCodedSourceAccountAddress, + TransactionID: 4096, + OperationID: 4130, + OperationDetails: map[string]interface{}{ + "function": "HostFunctionTypeHostFunctionTypeCreateContract", + "type": "create_contract", + "contract_id": "", + "contract_code_hash": "", + "from": "asset", + "asset": "", + }, + ClosedAt: hardCodedLedgerClose, + }, + OperationOutput{ + Type: 24, + TypeString: "invoke_host_function", + SourceAccount: hardCodedSourceAccountAddress, + TransactionID: 4096, + OperationID: 4131, + OperationDetails: map[string]interface{}{ + "function": "HostFunctionTypeHostFunctionTypeUploadContractWasm", + "type": "upload_wasm", + "contract_code_hash": "", + }, + ClosedAt: hardCodedLedgerClose, + }, + OperationOutput{ + Type: 25, + TypeString: "bump_footprint_expiration", + SourceAccount: hardCodedSourceAccountAddress, + TransactionID: 4096, + OperationID: 4132, + OperationDetails: map[string]interface{}{ + "type": "bump_footprint_expiration", + "ledgers_to_expire": 1234, + "contract_id": "", + "contract_code_hash": "", + }, + ClosedAt: hardCodedLedgerClose, + }, + OperationOutput{ + Type: 26, + TypeString: "restore_footprint", + SourceAccount: hardCodedSourceAccountAddress, + TransactionID: 4096, + OperationID: 4133, + OperationDetails: map[string]interface{}{ + "type": "restore_footprint", + "contract_id": "", + "contract_code_hash": "", + }, + ClosedAt: hardCodedLedgerClose, + }, } return }