From 0675feeb95dbe1f604dc827d91e05813f1611973 Mon Sep 17 00:00:00 2001 From: Christian Rogobete <c.rogobete@soneso.com> Date: Tue, 12 Dec 2023 19:20:51 +0100 Subject: [PATCH 1/3] prepare for soroban 20.0.0 --- lib/src/responses/asset_response.dart | 43 +++++++++++------- ...tend_footprint_ttl_operation_response.dart | 4 +- lib/src/soroban/soroban_server.dart | 39 ++++++++-------- test/soroban_test.dart | 42 ++++++++--------- test/soroban_test_atomic_swap.dart | 37 ++++++++------- test/soroban_test_auth.dart | 34 +++++--------- test/wasm/soroban_atomic_swap_contract.wasm | Bin 1846 -> 2002 bytes test/wasm/soroban_auth_contract.wasm | Bin 992 -> 988 bytes test/wasm/soroban_events_contract.wasm | Bin 746 -> 742 bytes test/wasm/soroban_hello_world_contract.wasm | Bin 543 -> 539 bytes test/wasm/soroban_token_contract.wasm | Bin 6425 -> 7471 bytes 11 files changed, 98 insertions(+), 101 deletions(-) mode change 100644 => 100755 test/wasm/soroban_atomic_swap_contract.wasm mode change 100644 => 100755 test/wasm/soroban_token_contract.wasm diff --git a/lib/src/responses/asset_response.dart b/lib/src/responses/asset_response.dart index 96cf3ac..f2db320 100644 --- a/lib/src/responses/asset_response.dart +++ b/lib/src/responses/asset_response.dart @@ -25,24 +25,29 @@ class AssetResponse extends Response { AssetResponseLinks links; int? numContracts; String? contractsAmount; + int? numArchivedContracts; + String? archivedContractsAmount; AssetResponse( - this.assetType, - this.assetCode, - this.assetIssuer, - this.accounts, - this.numClaimableBalances, - this.balances, - this.claimableBalancesAmount, - this.pagingToken, - this.amount, - this.numAccounts, - this.numLiquidityPools, - this.liquidityPoolsAmount, - this.flags, - this.links, - {this.numContracts, - this.contractsAmount}); + this.assetType, + this.assetCode, + this.assetIssuer, + this.accounts, + this.numClaimableBalances, + this.balances, + this.claimableBalancesAmount, + this.pagingToken, + this.amount, + this.numAccounts, + this.numLiquidityPools, + this.liquidityPoolsAmount, + this.flags, + this.links, { + this.numContracts, + this.contractsAmount, + this.numArchivedContracts, + this.archivedContractsAmount, + }); Asset get asset { return Asset.create(this.assetType, this.assetCode, this.assetIssuer); @@ -66,7 +71,11 @@ class AssetResponse extends Response { numContracts: json['num_contracts'] == null ? null : convertInt(json['num_contracts']!)!, - contractsAmount: json['contracts_amount']) + contractsAmount: json['contracts_amount'], + numArchivedContracts: json['num_archived_contracts'] == null + ? null + : convertInt(json['num_archived_contracts']!)!, + archivedContractsAmount: json['archived_contracts_amount']) ..rateLimitLimit = convertInt(json['rateLimitLimit']) ..rateLimitRemaining = convertInt(json['rateLimitRemaining']) ..rateLimitReset = convertInt(json['rateLimitReset']); diff --git a/lib/src/responses/operations/extend_footprint_ttl_operation_response.dart b/lib/src/responses/operations/extend_footprint_ttl_operation_response.dart index 2a80092..c6c54cb 100644 --- a/lib/src/responses/operations/extend_footprint_ttl_operation_response.dart +++ b/lib/src/responses/operations/extend_footprint_ttl_operation_response.dart @@ -10,9 +10,7 @@ class ExtendFootprintTTLOperationResponse extends OperationResponse { factory ExtendFootprintTTLOperationResponse.fromJson( Map<String, dynamic> json) => ExtendFootprintTTLOperationResponse(convertInt( - json['ledgers_to_expire'] == null - ? json['extend_to'] - : json['ledgers_to_expire'])!) + json['extend_to'])!) ..id = int.tryParse(json['id']) ..sourceAccount = json['source_account'] == null ? null : json['source_account'] diff --git a/lib/src/soroban/soroban_server.dart b/lib/src/soroban/soroban_server.dart index 8b20c05..4a2ac39 100644 --- a/lib/src/soroban/soroban_server.dart +++ b/lib/src/soroban/soroban_server.dart @@ -263,7 +263,7 @@ class GetLatestLedgerResponse extends SorobanRpcResponse { String? id; /// Stellar Core protocol version associated with the latest ledger. - String? protocolVersion; + int? protocolVersion; /// Sequence number of the latest ledger. int? sequence; @@ -313,7 +313,7 @@ class GetLedgerEntriesResponse extends SorobanRpcResponse { List<LedgerEntry>? entries; /// The current latest ledger observed by the node when this response was generated. - String? latestLedger; + int? latestLedger; GetLedgerEntriesResponse(Map<String, dynamic> jsonResponse) : super(jsonResponse); @@ -340,10 +340,10 @@ class LedgerEntry { String xdr; /// The ledger number of the last time this entry was updated (optional) - String lastModifiedLedgerSeq; + int lastModifiedLedgerSeq; /// The ledger sequence number after which the ledger entry would expire. This field exists only for ContractCodeEntry and ContractDataEntry ledger entries (optional). - String? liveUntilLedgerSeq; + int? liveUntilLedgerSeq; XdrLedgerEntryData get ledgerEntryDataXdr => XdrLedgerEntryData.fromBase64EncodedXdrString(xdr); @@ -354,8 +354,8 @@ class LedgerEntry { factory LedgerEntry.fromJson(Map<String, dynamic> json) { String key = json['key']; String xdr = json['xdr']; - String lastModifiedLedgerSeq = json['lastModifiedLedgerSeq']; - String? liveUntilLedgerSeq = json['liveUntilLedgerSeq']; + int lastModifiedLedgerSeq = json['lastModifiedLedgerSeq']; + int? liveUntilLedgerSeq = json['liveUntilLedgerSeq']; return LedgerEntry(key, xdr, lastModifiedLedgerSeq, liveUntilLedgerSeq); } } @@ -364,7 +364,7 @@ class LedgerEntry { class GetNetworkResponse extends SorobanRpcResponse { String? friendbotUrl; String? passphrase; - String? protocolVersion; + int? protocolVersion; GetNetworkResponse(Map<String, dynamic> jsonResponse) : super(jsonResponse); @@ -408,8 +408,8 @@ class RestorePreamble { /// Response that will be received when submitting a trial contract invocation. /// See: https://soroban.stellar.org/api/methods/simulateTransaction class SimulateTransactionResponse extends SorobanRpcResponse { - /// Stringified-number of the current latest ledger observed by the node when this response was generated. - String? latestLedger; + /// number of the current latest ledger observed by the node when this response was generated. + int? latestLedger; /// If error is present then results will not be in the response /// There will be one results object for each operation in the transaction. @@ -558,7 +558,7 @@ class SendTransactionResponse extends SorobanRpcResponse { String? status; /// The latest ledger known to Soroban-RPC at the time it handled the sendTransaction() request. - String? latestLedger; + int? latestLedger; /// The unix timestamp of the close time of the latest ledger known to Soroban-RPC at the time it handled the sendTransaction() request. String? latestLedgerCloseTime; @@ -596,19 +596,19 @@ class GetTransactionResponse extends SorobanRpcResponse { String? status; /// The latest ledger known to Soroban-RPC at the time it handled the getTransaction() request. - String? latestLedger; + int? latestLedger; /// The unix timestamp of the close time of the latest ledger known to Soroban-RPC at the time it handled the getTransaction() request. String? latestLedgerCloseTime; /// The oldest ledger ingested by Soroban-RPC at the time it handled the getTransaction() request. - String? oldestLedger; + int? oldestLedger; /// The unix timestamp of the close time of the oldest ledger ingested by Soroban-RPC at the time it handled the getTransaction() request. String? oldestLedgerCloseTime; /// (optional) The sequence of the ledger which included the transaction. This field is only present if status is SUCCESS or FAILED. - String? ledger; + int? ledger; /// (optional) The unix timestamp of when the transaction was included in the ledger. This field is only present if status is SUCCESS or FAILED. String? createdAt; @@ -709,11 +709,11 @@ class GetTransactionResponse extends SorobanRpcResponse { /// Holds the request parameters for getEvents. /// See: https://soroban.stellar.org/api/methods/getEvents class GetEventsRequest { - /// Stringified ledger sequence number to fetch events after (inclusive). + /// ledger sequence number to fetch events after (inclusive). /// The getEvents method will return an error if startLedger is less than the oldest ledger stored in this node, /// or greater than the latest ledger seen by this node. /// If a cursor is included in the request, startLedger must be omitted. - String? startLedger; + int? startLedger; /// List of filters for the returned events. Events matching any of the filters are included. /// To match a filter, an event must match both a contractId and a topic. @@ -822,7 +822,7 @@ class PaginationOptions { } class GetEventsResponse extends SorobanRpcResponse { - String? latestLedger; + int? latestLedger; /// If error is present then results will not be in the response List<EventInfo>? events; @@ -846,16 +846,17 @@ class GetEventsResponse extends SorobanRpcResponse { class EventInfo { String type; - String ledger; + int ledger; String ledgerCloseAt; String contractId; String id; String paginationToken; List<String> topic; String value; + bool inSuccessfulContractCall; EventInfo(this.type, this.ledger, this.ledgerCloseAt, this.contractId, - this.id, this.paginationToken, this.topic, this.value); + this.id, this.paginationToken, this.topic, this.value, this.inSuccessfulContractCall); factory EventInfo.fromJson(Map<String, dynamic> json) { List<String> topic = List<String>.from(json['topic'].map((e) => e)); @@ -868,7 +869,7 @@ class EventInfo { } return EventInfo(json['type'], json['ledger'], json['ledgerClosedAt'], - json['contractId'], json['id'], json['pagingToken'], topic, value); + json['contractId'], json['id'], json['pagingToken'], topic, value, json['inSuccessfulContractCall']); } } diff --git a/test/soroban_test.dart b/test/soroban_test.dart index 4cfca2b..5900a06 100644 --- a/test/soroban_test.dart +++ b/test/soroban_test.dart @@ -6,9 +6,9 @@ import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; void main() { SorobanServer sorobanServer = - SorobanServer("https://soroban-testnet.stellar.org"); + SorobanServer("https://rpc-futurenet.stellar.org"); - StellarSDK sdk = StellarSDK.TESTNET; + StellarSDK sdk = StellarSDK.FUTURENET; KeyPair keyPairA = KeyPair.random(); String accountAId = keyPairA.accountId; @@ -32,7 +32,7 @@ void main() { try { await sdk.accounts.account(accountAId); } catch (e) { - await FriendBot.fundTestAccount(accountAId); + await FuturenetFriendBot.fundTestAccount(accountAId); await Future.delayed(const Duration(seconds: 3), () {}); } }); @@ -103,7 +103,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee! + 5000); - transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -164,7 +164,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -200,7 +200,7 @@ void main() { OperationResponse operationResponse = operations.records!.first; if (operationResponse is ExtendFootprintTTLOperationResponse) { - assert("bump_footprint_expiration" == operationResponse.type); + assert("extend_footprint_ttl" == operationResponse.type); } else { assert(false); } @@ -216,9 +216,9 @@ void main() { GetNetworkResponse networkResponse = await sorobanServer.getNetwork(); assert(!networkResponse.isErrorResponse); - assert("https://friendbot.stellar.org/" == + assert("https://friendbot-futurenet.stellar.org/" == networkResponse.friendbotUrl); - assert("Test SDF Network ; September 2015" == + assert("Test SDF Future Network ; October 2022" == networkResponse.passphrase); }); @@ -229,7 +229,7 @@ void main() { assert(!latestLedgerResponse.isErrorResponse); assert(latestLedgerResponse.id != null); assert(latestLedgerResponse.protocolVersion != null); - assert("20" == latestLedgerResponse.protocolVersion); + assert(20 == latestLedgerResponse.protocolVersion); assert(latestLedgerResponse.sequence != null); }); @@ -271,7 +271,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -359,7 +359,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -448,7 +448,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -531,7 +531,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); SendTransactionResponse sendResponse = await sorobanServer.sendTransaction(transaction); @@ -567,7 +567,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.setSorobanAuth(simulateResponse.sorobanAuth); transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); sendResponse = await sorobanServer.sendTransaction(transaction); assert(sendResponse.error == null); @@ -602,7 +602,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); sendResponse = await sorobanServer.sendTransaction(transaction); assert(sendResponse.error == null); @@ -614,7 +614,7 @@ void main() { // query events TransactionResponse transactionResponse = await sdk.transactions.transaction(sendResponse.hash!); - String startLedger = transactionResponse.ledger.toString(); + int startLedger = transactionResponse.ledger; // seams that position of the topic in the filter must match event topics ... TopicFilter topicFilter = TopicFilter( @@ -698,7 +698,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.setSorobanAuth(simulateResponse.sorobanAuth); transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -742,7 +742,7 @@ void main() { }); test('test SAC with asset', () async { - await FriendBot.fundTestAccount(accountBId); + await FuturenetFriendBot.fundTestAccount(accountBId); await Future.delayed(Duration(seconds: 5)); // prepare trustline @@ -757,8 +757,8 @@ void main() { .addOperation(ctOp.build()) .addOperation(pOp.build()) .build(); - transaction.sign(keyPairA, Network.TESTNET); - transaction.sign(keyPairB, Network.TESTNET); + transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairB, Network.FUTURENET); SubmitTransactionResponse response = await sdk.submitTransaction(transaction); assert(response.success); @@ -791,7 +791,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(keyPairB, Network.TESTNET); + transaction.sign(keyPairB, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); diff --git a/test/soroban_test_atomic_swap.dart b/test/soroban_test_atomic_swap.dart index d8d9aef..fca5c33 100644 --- a/test/soroban_test_atomic_swap.dart +++ b/test/soroban_test_atomic_swap.dart @@ -5,9 +5,9 @@ import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; void main() { SorobanServer sorobanServer = - SorobanServer("https://soroban-testnet.stellar.org"); + SorobanServer("https://rpc-futurenet.stellar.org"); - StellarSDK sdk = StellarSDK.TESTNET; + StellarSDK sdk = StellarSDK.FUTURENET; KeyPair adminKeypair = KeyPair.random(); String adminId = adminKeypair.accountId; @@ -33,21 +33,21 @@ void main() { try { await sdk.accounts.account(adminId); } catch (e) { - await FriendBot.fundTestAccount(adminId); + await FuturenetFriendBot.fundTestAccount(adminId); print("admin " + adminId + " : " + adminKeypair.secretSeed); } try { await sdk.accounts.account(aliceId); } catch (e) { - await FriendBot.fundTestAccount(aliceId); + await FuturenetFriendBot.fundTestAccount(aliceId); print("alice " + aliceId + " : " + aliceKeypair.secretSeed); } try { await sdk.accounts.account(bobId); } catch (e) { - await FriendBot.fundTestAccount(bobId); + await FuturenetFriendBot.fundTestAccount(bobId); print("bob " + bobId + " : " + bobKeypair.secretSeed); } }); @@ -95,7 +95,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(adminKeypair, Network.TESTNET); + transaction.sign(adminKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -141,7 +141,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(adminKeypair, Network.TESTNET); + transaction.sign(adminKeypair, Network.FUTURENET); // send transaction to soroban rpc server SendTransactionResponse sendResponse = @@ -195,7 +195,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(adminKeypair, Network.TESTNET); + transaction.sign(adminKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -246,7 +246,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(adminKeypair, Network.TESTNET); + transaction.sign(adminKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -294,7 +294,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(adminKeypair, Network.TESTNET); + transaction.sign(adminKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -352,7 +352,6 @@ void main() { transaction = new TransactionBuilder(accountA).addOperation(restoreOp).build(); transaction.sorobanTransactionData = transactionData; - transaction.addResourceFee(10000); // simulate first to obtain the transaction data + resource fee simulateResponse = await sorobanServer.simulateTransaction(transaction); @@ -364,7 +363,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(adminKeypair, Network.TESTNET); + transaction.sign(adminKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -424,7 +423,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(adminKeypair, Network.TESTNET); + transaction.sign(adminKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -459,7 +458,7 @@ void main() { OperationResponse operationResponse = operations.records!.first; if (operationResponse is ExtendFootprintTTLOperationResponse) { - assert("bump_footprint_expiration" == operationResponse.type); + assert("extend_footprint_ttl" == operationResponse.type); } else { assert(false); } @@ -578,13 +577,13 @@ void main() { assert(simulateResponse.transactionData != null); // set transaction data, add resource fee and sign transaction - int instructions = + /*int instructions = simulateResponse.transactionData!.resources.instructions.uint32; instructions += (instructions / 4).round(); simulateResponse.transactionData!.resources.instructions = XdrUint32(instructions); simulateResponse.minResourceFee = - simulateResponse.minResourceFee! + 1005000; + simulateResponse.minResourceFee! + 1005000;*/ transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); // sign auth @@ -598,14 +597,14 @@ void main() { latestLedgerResponse.sequence! + 10; if (a.credentials.addressCredentials!.address.accountId == aliceId) { - a.sign(aliceKeypair, Network.TESTNET); + a.sign(aliceKeypair, Network.FUTURENET); } if (a.credentials.addressCredentials!.address.accountId == bobId) { - a.sign(bobKeypair, Network.TESTNET); + a.sign(bobKeypair, Network.FUTURENET); } } transaction.setSorobanAuth(auth); - transaction.sign(swapSubmitterKp, Network.TESTNET); + transaction.sign(swapSubmitterKp, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); diff --git a/test/soroban_test_auth.dart b/test/soroban_test_auth.dart index d82a2f6..04bedd2 100644 --- a/test/soroban_test_auth.dart +++ b/test/soroban_test_auth.dart @@ -5,9 +5,9 @@ import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; void main() { SorobanServer sorobanServer = - SorobanServer("https://soroban-testnet.stellar.org"); + SorobanServer("https://rpc-futurenet.stellar.org"); - StellarSDK sdk = StellarSDK.TESTNET; + StellarSDK sdk = StellarSDK.FUTURENET; KeyPair submitterKeypair = KeyPair.random(); String submitterId = submitterKeypair.accountId; @@ -25,13 +25,13 @@ void main() { try { await sdk.accounts.account(submitterId); } catch (e) { - await FriendBot.fundTestAccount(submitterId); + await FuturenetFriendBot.fundTestAccount(submitterId); } try { await sdk.accounts.account(invokerId); } catch (e) { - await FriendBot.fundTestAccount(invokerId); + await FuturenetFriendBot.fundTestAccount(invokerId); } }); @@ -89,7 +89,6 @@ void main() { transaction = new TransactionBuilder(accountA).addOperation(restoreOp).build(); transaction.sorobanTransactionData = transactionData; - transaction.addResourceFee(10000); // simulate first to obtain the transaction data + resource fee simulateResponse = await sorobanServer.simulateTransaction(transaction); @@ -101,7 +100,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(submitterKeypair, Network.TESTNET); + transaction.sign(submitterKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -161,7 +160,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(submitterKeypair, Network.TESTNET); + transaction.sign(submitterKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -196,7 +195,7 @@ void main() { OperationResponse operationResponse = operations.records!.first; if (operationResponse is ExtendFootprintTTLOperationResponse) { - assert("bump_footprint_expiration" == operationResponse.type); + assert("extend_footprint_ttl" == operationResponse.type); } else { assert(false); } @@ -231,7 +230,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(submitterKeypair, Network.TESTNET); + transaction.sign(submitterKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -279,7 +278,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(submitterKeypair, Network.TESTNET); + transaction.sign(submitterKeypair, Network.FUTURENET); // send transaction to soroban rpc server SendTransactionResponse sendResponse = @@ -323,15 +322,6 @@ void main() { assert(simulateResponse.transactionData != null); assert(simulateResponse.minResourceFee != null); - // this is because the fee calculation from the simulation is not always accurate - // see: https://discord.com/channels/897514728459468821/1112853306881081354 - int instructions = - simulateResponse.transactionData!.resources.instructions.uint32; - instructions += (instructions / 4).round(); - simulateResponse.transactionData!.resources.instructions = - XdrUint32(instructions); - simulateResponse.minResourceFee = simulateResponse.minResourceFee! + 6000; - // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); @@ -344,10 +334,10 @@ void main() { // update signature expiration ledger a.credentials.addressCredentials!.signatureExpirationLedger = latestLedgerResponse.sequence! + 10; // sign - a.sign(invokerKeypair, Network.TESTNET); + a.sign(invokerKeypair, Network.FUTURENET); } transaction.setSorobanAuth(auth); - transaction.sign(submitterKeypair, Network.TESTNET); + transaction.sign(submitterKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -432,7 +422,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(invokerKeypair, Network.TESTNET); + transaction.sign(invokerKeypair, Network.FUTURENET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); diff --git a/test/wasm/soroban_atomic_swap_contract.wasm b/test/wasm/soroban_atomic_swap_contract.wasm old mode 100644 new mode 100755 index f2c9e1be7ba1d9f42d34dbdf09b1987cd66fd031..36a1833f33e8b81a546bb063602831b9ae01dbb3 GIT binary patch literal 2002 zcmZ8h&2k$>5bl}P?vAvQSpx^hR8g}^4sgKOitSBKc(=--sBj35;VQ3w0+CCSk&Fpd zu_UnUgufy@0Y^?ga>f^m6EDDp*Wf^v`Fcj{*j|--x_iFvp6Tvs%7$G*MB>Bp4vEo@ z9F0H)6K7=kF{{T+eQ5Zj9e1`8?I^>77#Q}%nB<BQPecs2nW&Qx2jWxE$Kno2(Ady* zXd0pe+5*OL%0WT6p0A1}6)4vcH1FMT#v++a&L|jD@_e?w;MHGty>7ePAABXLF#Iyx zqd7QvwN$USvi+>y?zJ2d)a#$Mv%PvF8@3%;`nMGPEu<Jbqni_al$_CSRopVXrnj9i zlDsTL4lkrBQ5~$|w+xO7TCiF}{nkr$>?}ZEh@B9N6FUlvj2%iSB4;EwfY$F<j3_r8 zBi^eBEfU?))B%{-7Yt0ah{_ZMW;ZE>-<h});u&>j$CR(wZP=w8=aShbak!MPgYS%< zrsuPdKB)kx=@{GZJ=5ZNn$i}lQgxCBQ+BB-Jcbnoi%_4Y`Xnt(wU{yCH)g9T#0YLg z2x&r9Upu-G{=hu6zLwh6o|WZ>E@<x<1j`|C?)K?n)jK{)#~)WH{E=-aFjmN#b`NvI z;6LdKG@AX-%Cx*&b?x<2ioE1W<jW2IA)WqaMWiB92<UTvOsMk?QMH)-L-%mO;;Gpx zCJ#DE>4ORZR!n{$calX2V1EI7<9@}}D&2e<sj>{f-DgfPw*@YMW6_Cxt+bbVC)3C? zCGt3Rb5n!l2A$+dOQ)P25uWfJ+1xd0GCjmy;&OW^EW&mP?&9Dsh_Yb)$gK5>(U zj`ll%`+1-E=*q}9haen^5s71aC49y~({pi@%B>3Oku1;p1|^=kvR!k@3G2h3*^q)F zg)c1kn<M48kU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h%#st0O_Pk0Q!E((v;7tt delta 101 zcmcb^{(yZ$8PjARW;td{hT_S&%xb<ydIk(Iz)@6OoRVFZS_Bj@HZsryLfxWdL*+Dc v6XO)KG|N;I%jCpF0}D$d6JtXQO9S)d6a!NWizG9H6!SDg3v-6arA*fV;?@}_ diff --git a/test/wasm/soroban_events_contract.wasm b/test/wasm/soroban_events_contract.wasm index 9364353dcc64163f6eee12b36423a26af505f860..0cb6cbec84b7da19e777815bea852eaed2cbd595 100755 GIT binary patch delta 102 zcmaFG`iymgEu-N^yTy!?%a}?gKVXz+W?;yl%*3STX`*My00SIF#l<PvWvN9#0evF_ xJs?!JFfvL`HA_x5PBk$zOioU=G%__ZH%&4zH%c)#PclnRG&W5#N=~t4002n~8JPe8 delta 90 zcmaFH`igaeEu+y!yTy!?!<gilEg6a@moup`8|fKLUce-3YHVbn2ZXvs$%e{l<|f7| tW@(nGCYH&Gi3S#yMkdCF7M2F)$teb=78Xfn1}Wxgh8E@wlOHga0sw1i7<K>v diff --git a/test/wasm/soroban_hello_world_contract.wasm b/test/wasm/soroban_hello_world_contract.wasm index fbf7f7e3fa51d21a9a12a652de5108b0ff66e048..e7aa481ed57a1211c906ee5f6b0aff6e95720a10 100755 GIT binary patch delta 81 zcmbQwGMi<C8{_2Lj4qR18ReN781g5lGpaG0=owC)z$j{{Z)Bhcgvu61M#-sW$;rm4 jCT51o$;p;RrbgzbNhan-Ddy%$X32@hrb$N0DV7WXYJC+8 delta 101 zcmbQuGM{CG8{_0|Mmc6nhT_R<7}b1@^b8nafTO6mI3>F*wFoF+Y-FGZgt|q^hRSK? vCdMgdX_l!bmdS~U1{Rh^CdP&qmImg@DF&t%7D;9XDduU07Um3-T^U^g#Hbi1 diff --git a/test/wasm/soroban_token_contract.wasm b/test/wasm/soroban_token_contract.wasm old mode 100644 new mode 100755 index d86fdac174b40d2c74effdc5a02229854a5566c6..8d558b144d3cfbc5ee400edfbd5178a711600ce6 GIT binary patch literal 7471 zcmc&(YiwLc6`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^kgBO5ok{Ij&*gg1Rj$V`vpad4*T-zDO<lL2_v z`&D+D7ViAKkv}W}nspbF7VLaIux@`C`E7K?m!0sZ)$*vUC)t_0A+_9Y?cc=4C&|tA zZd;$vuJu>6Y@AzPI&K)A?_K5c?9teZZ+BDt&#;fFD`6|!#Z0~touA$y$1M?>{`GMT zVLrG23~_nSW5%U(J$(lB@i#>86k2me<-#_up%-o9WhN)~PvB<XJx)ue)0~eQ4vK69 zc^fIq5X*!A1Gq=eM(s+gy1*&TunEiSM;F5SLM`&E+}5K;r`kB}cg{q9jK=+W)H)Sb HBBK8Sm`4@$ From 0fac78b7a0b226a232e762c25eaf44adee94422c Mon Sep 17 00:00:00 2001 From: Christian Rogobete <c.rogobete@soneso.com> Date: Sun, 17 Dec 2023 21:42:13 +0100 Subject: [PATCH 2/3] add resource config for soroban transaction simulation --- lib/src/soroban/soroban_server.dart | 40 ++++++++++++++++++++++-- soroban.md | 47 +++++++++-------------------- test/soroban_test.dart | 34 ++++++++++++++------- test/soroban_test_atomic_swap.dart | 27 +++++++++++------ test/soroban_test_auth.dart | 21 ++++++++----- 5 files changed, 107 insertions(+), 62 deletions(-) diff --git a/lib/src/soroban/soroban_server.dart b/lib/src/soroban/soroban_server.dart index 4a2ac39..dbd0d98 100644 --- a/lib/src/soroban/soroban_server.dart +++ b/lib/src/soroban/soroban_server.dart @@ -157,11 +157,10 @@ class SorobanServer { /// expected ledger footprint, and expected costs. /// See: https://soroban.stellar.org/api/methods/simulateTransaction Future<SimulateTransactionResponse> simulateTransaction( - Transaction transaction) async { - String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); + SimulateTransactionRequest request) async { JsonRpcMethod getAccount = - JsonRpcMethod("simulateTransaction", args: transactionEnvelopeXdr); + JsonRpcMethod("simulateTransaction", args: request.getRequestArgs()); dio.Response response = await _dio.post(_serverUrl, data: json.encode(getAccount), options: dio.Options(headers: _headers)); if (enableLogging) { @@ -405,6 +404,41 @@ class RestorePreamble { } } +/// Part of the SimulateTransactionRequest. +/// Allows budget instruction leeway used in preflight calculations to be configured. +class ResourceConfig { + int instructionLeeway; + + ResourceConfig(this.instructionLeeway); + + Map<String, dynamic> getRequestArgs() { + var map = <String, dynamic>{}; + map['instructionLeeway'] = instructionLeeway; + return map; + } +} +/// Holds the request parameters for simulateTransaction. +/// See: https://soroban.stellar.org/api/methods/simulateTransaction +class SimulateTransactionRequest { + /// The transaction to be submitted. + Transaction transaction; + + /// Allows budget instruction leeway used in preflight calculations to be configured + /// If not provided the leeway defaults to 3000000 instructions + ResourceConfig? resourceConfig; + + SimulateTransactionRequest(this.transaction, {this.resourceConfig}); + + Map<String, dynamic> getRequestArgs() { + var map = <String, dynamic>{}; + map['transaction'] = transaction.toEnvelopeXdrBase64(); + if (resourceConfig != null) { + map['resourceConfig'] = resourceConfig!.getRequestArgs(); + } + return map; + } +} + /// Response that will be received when submitting a trial contract invocation. /// See: https://soroban.stellar.org/api/methods/simulateTransaction class SimulateTransactionResponse extends SorobanRpcResponse { diff --git a/soroban.md b/soroban.md index 9765315..73ebd2d 100644 --- a/soroban.md +++ b/soroban.md @@ -2,15 +2,11 @@ ## [Stellar SDK for Flutter](https://github.com/Soneso/stellar_flutter_sdk) ## Soroban support -The following shows you how to use the Flutter SDK to start experimenting with Soroban smart contracts. - -**Please note, that both, Soroban itself and the Flutter SDK support for Soroban are still under development, so breaking changes may occur.** - -**Soroban version supported: Preview 11** +The following shows you how to use the Flutter SDK to interact with Soroban. ### Quick Start -Flutter SDK Soroban support allows you to deploy and to invoke smart contracts on Futurenet. Futurenet is a special test network provided by Stellar. +Flutter SDK Soroban support allows you to deploy and to invoke Soroban smart contracts. To deploy and/or invoke smart contracts with the Flutter SDK use the ```SorobanServer``` class. It connects to a given local or remote Soroban-RPC Server. @@ -39,12 +35,12 @@ if (GetHealthResponse.HEALTHY == healthResponse.status) { #### Get account data -You first need an account on Futurenet. For this one can use ```FuturenetFriendBot``` to fund it: +You first need an account on Testnet. For this one can use ```FriendBot``` to fund it: ```dart KeyPair accountKeyPair = KeyPair.random(); String accountId = accountKeyPair.accountId; -await FuturenetFriendBot.fundTestAccount(accountId); +await FriendBot.fundTestAccount(accountId); ``` Next you can fetch current information about your Stellar account using the SDK: @@ -79,15 +75,16 @@ Next we need to **simulate** the transaction to obtain the **soroban transaction ```dart // Simulate first to obtain the footprint +var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); ``` On success, one can find the **soroban transaction data** and the **resource fee** in the response. Next we need to set the **soroban transaction data** and the **resource fee** to our transaction, then **sign** the transaction and send it to the network using the ```SorobanServer```: ```dart transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); -transaction.sign(accountKeyPair, Network.FUTURENET); +transaction.sign(accountKeyPair, Network.TESTNET); // send transaction to soroban rpc server SendTransactionResponse sendResponse = @@ -123,7 +120,7 @@ if (GetTransactionResponse.STATUS_NOT_FOUND == status) { } ``` -Hint: If you experience an error with the transaction result ```txInternalError``` it is most likely that a ledger entry used in the transaction has expired. This is an issue specific to soroban prev. 10 (see [here](https://discord.com/channels/897514728459468821/1130347673627664515)). You can fix it by restoring the footprint (see this [example](https://github.com/Soneso/stellar_flutter_sdk/blob/9a15982ac862bdcab33713184c800065e573f39b/test/soroban_test.dart#L57) in the soroban test of the SDK). +Hint: If you experience an error with the transaction result ```txInternalError``` it is most likely that a ledger entry used in the transaction has expired. You can fix it by restoring the footprint (see this [example](https://github.com/Soneso/stellar_flutter_sdk/blob/9a15982ac862bdcab33713184c800065e573f39b/test/soroban_test.dart#L57) in the soroban test of the SDK). If the transaction was successful, the status response contains the ```wasmId``` of the installed contract code. We need the ```wasmId``` in our next step to **create** the contract: @@ -139,14 +136,15 @@ Transaction transaction = new TransactionBuilder(account) .addOperation(operation).build(); // First simulate to obtain the transaction data + resource fee +var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); // set transaction data, add resource fee & auth and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); -transaction.sign(accountKeyPair, Network.FUTURENET); +transaction.sign(accountKeyPair, Network.TESTNET); // Send the transaction to the network. SendTransactionResponse sendResponse = @@ -250,8 +248,9 @@ Next we need to **simulate** the transaction to obtain the **soroban transaction ```dart // Simulate first to obtain the footprint +var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); ``` On success, one can find the **soroban transaction data** and the **resource fee** in the response. Next we need to set it to our transaction, **sign** the transaction and send it to the network using the ```SorobanServer```: @@ -259,7 +258,7 @@ On success, one can find the **soroban transaction data** and the **resource fe // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); -transaction.sign(accountKeyPair, Network.FUTURENET); +transaction.sign(accountKeyPair, Network.TESTNET); // send transaction to soroban rpc server SendTransactionResponse sendResponse = @@ -373,7 +372,7 @@ for (SorobanAuthorizationEntry a in auth!) { a.credentials.addressCredentials!.signatureExpirationLedger = latestLedgerResponse.sequence! + 10; // sign - a.sign(invokerKeypair, Network.FUTURENET); + a.sign(invokerKeypair, Network.TESTNET); } transaction.setSorobanAuth(auth); @@ -381,22 +380,6 @@ transaction.setSorobanAuth(auth); One can find multiple examples in the [Soroban Auth Test](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test_auth.dart) and [Soroban Atomic Swap Test](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test_atomic_swap.dart) of the SDK. - -Hint: Resource values and fees have been added since soroban preview 9 version. The calculation of the minimum resource values and fee by the simulation (preflight) is not always accurate, because it does not consider signatures. This may result in a failing transaction because of insufficient resources. In this case one can experiment and increase the resources values within the soroban transaction data before signing and submitting the transaction. E.g.: - -```dart -int instructions = simulateResponse.transactionData!.resources.instructions.uint32; -instructions += (instructions / 4).round(); -simulateResponse.transactionData!.resources.instructions = XdrUint32(instructions); -simulateResponse.minResourceFee = simulateResponse.minResourceFee! + 3000; - -// set transaction data, add resource fee and sign transaction -transaction.sorobanTransactionData = simulateResponse.transactionData; -transaction.addResourceFee(simulateResponse.minResourceFee!); -transaction.sign(submitterKeypair, Network.FUTURENET); -``` -See also: https://discord.com/channels/897514728459468821/1112853306881081354 - #### Get Events The Soroban-RPC server provides the possibility to request contract events. diff --git a/test/soroban_test.dart b/test/soroban_test.dart index 5900a06..ef8187b 100644 --- a/test/soroban_test.dart +++ b/test/soroban_test.dart @@ -73,8 +73,9 @@ void main() { new TransactionBuilder(accountA).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -94,7 +95,8 @@ void main() { transaction.sorobanTransactionData = transactionData; // simulate first to obtain the transaction data + resource fee - simulateResponse = await sorobanServer.simulateTransaction(transaction); + request = new SimulateTransactionRequest(transaction); + simulateResponse = await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -153,8 +155,10 @@ void main() { transaction.sorobanTransactionData = transactionData; // simulate first to obtain the transaction data + resource fee + var resourceConfig = new ResourceConfig(300000); + var request = new SimulateTransactionRequest(transaction, resourceConfig:resourceConfig); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); // assert(simulateResponse.results != null); assert(simulateResponse.resultError == null); @@ -255,8 +259,9 @@ void main() { new TransactionBuilder(accountA).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.results != null); assert(simulateResponse.resultError == null); @@ -342,8 +347,9 @@ void main() { new TransactionBuilder(accountA).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.results != null); assert(simulateResponse.resultError == null); @@ -434,8 +440,9 @@ void main() { new TransactionBuilder(accountA).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.results != null); assert(simulateResponse.resultError == null); @@ -524,8 +531,9 @@ void main() { Transaction transaction = new TransactionBuilder(submitter).addOperation(operation).build(); + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.transactionData != null); // set transaction data, add resource fee and sign transaction @@ -560,7 +568,8 @@ void main() { transaction = new TransactionBuilder(submitter).addOperation(operation).build(); - simulateResponse = await sorobanServer.simulateTransaction(transaction); + request = SimulateTransactionRequest(transaction); + simulateResponse = await sorobanServer.simulateTransaction(request); assert(simulateResponse.transactionData != null); // set transaction data, add resource fee and sign transaction @@ -596,7 +605,8 @@ void main() { transaction = new TransactionBuilder(submitter).addOperation(operation).build(); - simulateResponse = await sorobanServer.simulateTransaction(transaction); + request = SimulateTransactionRequest(transaction); + simulateResponse = await sorobanServer.simulateTransaction(request); assert(simulateResponse.transactionData != null); // set transaction data, add resource fee and sign transaction @@ -681,8 +691,9 @@ void main() { new TransactionBuilder(accountA).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.results != null); assert(simulateResponse.resultError == null); @@ -774,8 +785,9 @@ void main() { new TransactionBuilder(accountB).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.results != null); assert(simulateResponse.resultError == null); diff --git a/test/soroban_test_atomic_swap.dart b/test/soroban_test_atomic_swap.dart index fca5c33..7008a52 100644 --- a/test/soroban_test_atomic_swap.dart +++ b/test/soroban_test_atomic_swap.dart @@ -87,8 +87,9 @@ void main() { new TransactionBuilder(submitter).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(!simulateResponse.isErrorResponse); assert(simulateResponse.transactionData != null); @@ -132,8 +133,9 @@ void main() { new TransactionBuilder(submitter).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(!simulateResponse.isErrorResponse); assert(simulateResponse.resultError == null); @@ -185,8 +187,9 @@ void main() { new TransactionBuilder(invoker).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.footprint != null); @@ -236,8 +239,9 @@ void main() { new TransactionBuilder(invoker).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -285,8 +289,9 @@ void main() { new TransactionBuilder(invoker).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -333,8 +338,9 @@ void main() { new TransactionBuilder(accountA).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -354,7 +360,8 @@ void main() { transaction.sorobanTransactionData = transactionData; // simulate first to obtain the transaction data + resource fee - simulateResponse = await sorobanServer.simulateTransaction(transaction); + request = SimulateTransactionRequest(transaction); + simulateResponse = await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -413,8 +420,9 @@ void main() { transaction.sorobanTransactionData = transactionData; // simulate first to obtain the transaction data + resource fee + var request = SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -570,8 +578,9 @@ void main() { new TransactionBuilder(swapSubmitter).addOperation(op).build(); // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); diff --git a/test/soroban_test_auth.dart b/test/soroban_test_auth.dart index 04bedd2..538baf0 100644 --- a/test/soroban_test_auth.dart +++ b/test/soroban_test_auth.dart @@ -70,8 +70,9 @@ void main() { new TransactionBuilder(accountA).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -91,7 +92,8 @@ void main() { transaction.sorobanTransactionData = transactionData; // simulate first to obtain the transaction data + resource fee - simulateResponse = await sorobanServer.simulateTransaction(transaction); + request = new SimulateTransactionRequest(transaction); + simulateResponse = await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -150,8 +152,9 @@ void main() { transaction.sorobanTransactionData = transactionData; // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.transactionData != null); @@ -222,8 +225,9 @@ void main() { new TransactionBuilder(submitter).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(!simulateResponse.isErrorResponse); assert(simulateResponse.transactionData != null); @@ -269,8 +273,9 @@ void main() { new TransactionBuilder(submitter).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(!simulateResponse.isErrorResponse); assert(simulateResponse.resultError == null); @@ -314,8 +319,9 @@ void main() { new TransactionBuilder(submitter).addOperation(operation).build(); // simulate first to obtain the transaction data + resource fee + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); @@ -412,8 +418,9 @@ void main() { new TransactionBuilder(invoker).addOperation(operation).build(); // simulate first to get transaction data + var request = new SimulateTransactionRequest(transaction); SimulateTransactionResponse simulateResponse = - await sorobanServer.simulateTransaction(transaction); + await sorobanServer.simulateTransaction(request); assert(simulateResponse.error == null); assert(simulateResponse.resultError == null); assert(simulateResponse.footprint != null); From 7d19207e3d5c634f1ffedb2cfcb74bb89ad17ff6 Mon Sep 17 00:00:00 2001 From: Christian Rogobete <c.rogobete@soneso.com> Date: Mon, 18 Dec 2023 19:42:34 +0100 Subject: [PATCH 3/3] update soroban tests for testnet --- soroban.md | 3 ++- test/query_test.dart | 4 ++-- test/soroban_test.dart | 36 +++++++++++++++--------------- test/soroban_test_atomic_swap.dart | 30 ++++++++++++------------- test/soroban_test_auth.dart | 22 +++++++++--------- 5 files changed, 48 insertions(+), 47 deletions(-) diff --git a/soroban.md b/soroban.md index 73ebd2d..d0395b9 100644 --- a/soroban.md +++ b/soroban.md @@ -21,7 +21,7 @@ The Soroban-RPC API is described [here](https://soroban.stellar.org/api/). Provide the url to the endpoint of the Soroban-RPC server to connect to: ```dart -SorobanServer sorobanServer = SorobanServer("https://rpc-futurenet.stellar.org:443"); +SorobanServer sorobanServer = SorobanServer("https://soroban-testnet.stellar.org"); ``` #### General node health check @@ -53,6 +53,7 @@ AccountResponse submitter = await sdk.accounts.account(submitterId); #### Deploy your contract If you want to create a smart contract for testing, you can find the official examples [here](https://github.com/stellar/soroban-examples). +You can also create smart contracts with our AssemblyScript Soroban SDK. Examples can be found [here](https://github.com/Soneso/as-soroban-examples). There are two main steps involved in the process of deploying a contract. First you need to **upload** the **contract code** and then to **create** the **contract**. diff --git a/test/query_test.dart b/test/query_test.dart index 403e16b..755e476 100644 --- a/test/query_test.dart +++ b/test/query_test.dart @@ -182,7 +182,7 @@ void main() { /// ! get Claimable Balance ID from BID result at claimable_balance_test.dart Page<OperationResponse> operationsPage = await sdk.operations .forClaimableBalance( - "00000000e883d22acfa2f9a904eb260262d2d53a013fdf618a423d03e4ffa5aca8e1936f") + "0000000070ceb102da32f678623f7d62d70bd9820776b4b995b3956eb5714692d419da78") .limit(1) .order(RequestBuilderOrder.DESC) .execute(); @@ -195,7 +195,7 @@ void main() { /// ! get Claimable Balance ID from BID result at claimable_balance_test.dart Page<TransactionResponse> transactionsPage = await sdk.transactions .forClaimableBalance( - "00000000d424d26a793f8af968cdfc01b3254ac634dc6c96da94405e719077a0a18f8ace") + "0000000070ceb102da32f678623f7d62d70bd9820776b4b995b3956eb5714692d419da78") .limit(1) .order(RequestBuilderOrder.DESC) .execute(); diff --git a/test/soroban_test.dart b/test/soroban_test.dart index ef8187b..8c2af8d 100644 --- a/test/soroban_test.dart +++ b/test/soroban_test.dart @@ -6,9 +6,9 @@ import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; void main() { SorobanServer sorobanServer = - SorobanServer("https://rpc-futurenet.stellar.org"); + SorobanServer("https://soroban-testnet.stellar.org"); - StellarSDK sdk = StellarSDK.FUTURENET; + StellarSDK sdk = StellarSDK.TESTNET; KeyPair keyPairA = KeyPair.random(); String accountAId = keyPairA.accountId; @@ -32,7 +32,7 @@ void main() { try { await sdk.accounts.account(accountAId); } catch (e) { - await FuturenetFriendBot.fundTestAccount(accountAId); + await FriendBot.fundTestAccount(accountAId); await Future.delayed(const Duration(seconds: 3), () {}); } }); @@ -105,7 +105,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee! + 5000); - transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -168,7 +168,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -220,9 +220,9 @@ void main() { GetNetworkResponse networkResponse = await sorobanServer.getNetwork(); assert(!networkResponse.isErrorResponse); - assert("https://friendbot-futurenet.stellar.org/" == + assert("https://friendbot.stellar.org/" == networkResponse.friendbotUrl); - assert("Test SDF Future Network ; October 2022" == + assert("Test SDF Network ; September 2015" == networkResponse.passphrase); }); @@ -276,7 +276,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -365,7 +365,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -455,7 +455,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -539,7 +539,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); SendTransactionResponse sendResponse = await sorobanServer.sendTransaction(transaction); @@ -576,7 +576,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.setSorobanAuth(simulateResponse.sorobanAuth); transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); sendResponse = await sorobanServer.sendTransaction(transaction); assert(sendResponse.error == null); @@ -612,7 +612,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); sendResponse = await sorobanServer.sendTransaction(transaction); assert(sendResponse.error == null); @@ -709,7 +709,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.setSorobanAuth(simulateResponse.sorobanAuth); transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(keyPairA, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -753,7 +753,7 @@ void main() { }); test('test SAC with asset', () async { - await FuturenetFriendBot.fundTestAccount(accountBId); + await FriendBot.fundTestAccount(accountBId); await Future.delayed(Duration(seconds: 5)); // prepare trustline @@ -768,8 +768,8 @@ void main() { .addOperation(ctOp.build()) .addOperation(pOp.build()) .build(); - transaction.sign(keyPairA, Network.FUTURENET); - transaction.sign(keyPairB, Network.FUTURENET); + transaction.sign(keyPairA, Network.TESTNET); + transaction.sign(keyPairB, Network.TESTNET); SubmitTransactionResponse response = await sdk.submitTransaction(transaction); assert(response.success); @@ -803,7 +803,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(keyPairB, Network.FUTURENET); + transaction.sign(keyPairB, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); diff --git a/test/soroban_test_atomic_swap.dart b/test/soroban_test_atomic_swap.dart index 7008a52..a74223c 100644 --- a/test/soroban_test_atomic_swap.dart +++ b/test/soroban_test_atomic_swap.dart @@ -5,9 +5,9 @@ import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; void main() { SorobanServer sorobanServer = - SorobanServer("https://rpc-futurenet.stellar.org"); + SorobanServer("https://soroban-testnet.stellar.org"); - StellarSDK sdk = StellarSDK.FUTURENET; + StellarSDK sdk = StellarSDK.TESTNET; KeyPair adminKeypair = KeyPair.random(); String adminId = adminKeypair.accountId; @@ -33,21 +33,21 @@ void main() { try { await sdk.accounts.account(adminId); } catch (e) { - await FuturenetFriendBot.fundTestAccount(adminId); + await FriendBot.fundTestAccount(adminId); print("admin " + adminId + " : " + adminKeypair.secretSeed); } try { await sdk.accounts.account(aliceId); } catch (e) { - await FuturenetFriendBot.fundTestAccount(aliceId); + await FriendBot.fundTestAccount(aliceId); print("alice " + aliceId + " : " + aliceKeypair.secretSeed); } try { await sdk.accounts.account(bobId); } catch (e) { - await FuturenetFriendBot.fundTestAccount(bobId); + await FriendBot.fundTestAccount(bobId); print("bob " + bobId + " : " + bobKeypair.secretSeed); } }); @@ -96,7 +96,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(adminKeypair, Network.FUTURENET); + transaction.sign(adminKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -143,7 +143,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(adminKeypair, Network.FUTURENET); + transaction.sign(adminKeypair, Network.TESTNET); // send transaction to soroban rpc server SendTransactionResponse sendResponse = @@ -198,7 +198,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(adminKeypair, Network.FUTURENET); + transaction.sign(adminKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -250,7 +250,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(adminKeypair, Network.FUTURENET); + transaction.sign(adminKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -299,7 +299,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(adminKeypair, Network.FUTURENET); + transaction.sign(adminKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -370,7 +370,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(adminKeypair, Network.FUTURENET); + transaction.sign(adminKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -431,7 +431,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(adminKeypair, Network.FUTURENET); + transaction.sign(adminKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -606,14 +606,14 @@ void main() { latestLedgerResponse.sequence! + 10; if (a.credentials.addressCredentials!.address.accountId == aliceId) { - a.sign(aliceKeypair, Network.FUTURENET); + a.sign(aliceKeypair, Network.TESTNET); } if (a.credentials.addressCredentials!.address.accountId == bobId) { - a.sign(bobKeypair, Network.FUTURENET); + a.sign(bobKeypair, Network.TESTNET); } } transaction.setSorobanAuth(auth); - transaction.sign(swapSubmitterKp, Network.FUTURENET); + transaction.sign(swapSubmitterKp, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); diff --git a/test/soroban_test_auth.dart b/test/soroban_test_auth.dart index 538baf0..7931efe 100644 --- a/test/soroban_test_auth.dart +++ b/test/soroban_test_auth.dart @@ -5,9 +5,9 @@ import 'package:stellar_flutter_sdk/stellar_flutter_sdk.dart'; void main() { SorobanServer sorobanServer = - SorobanServer("https://rpc-futurenet.stellar.org"); + SorobanServer("https://soroban-testnet.stellar.org"); - StellarSDK sdk = StellarSDK.FUTURENET; + StellarSDK sdk = StellarSDK.TESTNET; KeyPair submitterKeypair = KeyPair.random(); String submitterId = submitterKeypair.accountId; @@ -25,13 +25,13 @@ void main() { try { await sdk.accounts.account(submitterId); } catch (e) { - await FuturenetFriendBot.fundTestAccount(submitterId); + await FriendBot.fundTestAccount(submitterId); } try { await sdk.accounts.account(invokerId); } catch (e) { - await FuturenetFriendBot.fundTestAccount(invokerId); + await FriendBot.fundTestAccount(invokerId); } }); @@ -102,7 +102,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(submitterKeypair, Network.FUTURENET); + transaction.sign(submitterKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -163,7 +163,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(submitterKeypair, Network.FUTURENET); + transaction.sign(submitterKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -234,7 +234,7 @@ void main() { // set transaction data, add resource fee and sign transaction transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); - transaction.sign(submitterKeypair, Network.FUTURENET); + transaction.sign(submitterKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -283,7 +283,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(submitterKeypair, Network.FUTURENET); + transaction.sign(submitterKeypair, Network.TESTNET); // send transaction to soroban rpc server SendTransactionResponse sendResponse = @@ -340,10 +340,10 @@ void main() { // update signature expiration ledger a.credentials.addressCredentials!.signatureExpirationLedger = latestLedgerResponse.sequence! + 10; // sign - a.sign(invokerKeypair, Network.FUTURENET); + a.sign(invokerKeypair, Network.TESTNET); } transaction.setSorobanAuth(auth); - transaction.sign(submitterKeypair, Network.FUTURENET); + transaction.sign(submitterKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64(); @@ -429,7 +429,7 @@ void main() { transaction.sorobanTransactionData = simulateResponse.transactionData; transaction.addResourceFee(simulateResponse.minResourceFee!); transaction.setSorobanAuth(simulateResponse.sorobanAuth); - transaction.sign(invokerKeypair, Network.FUTURENET); + transaction.sign(invokerKeypair, Network.TESTNET); // check transaction xdr encoding and decoding back and forth String transactionEnvelopeXdr = transaction.toEnvelopeXdrBase64();