File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
docs/build/apps/example-application-tutorial Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -66,14 +66,33 @@ The layout of the page is quite similar to our contacts page. It has a table dis
6666 import { invalidateAll } from " $app/navigation" ;
6767
6868 // We import some of our `$lib` functions
69- import { submit } from " $lib/stellar/rpcQueries" ;
7069 import { createChangeTrustTransaction } from " $lib/stellar/transactions" ;
7170 import { fetchAssets } from " $lib/utils/stellarExpert" ;
71+
72+ // We import the Server from @stellar/stellar-sdk/rpc for transaction submission
73+ import { Server } from " @stellar/stellar-sdk/rpc" ;
74+ import { error } from " @sveltejs/kit" ;
7275
7376 // The `open` Svelte context is used to open the confirmation modal
7477 import { getContext } from " svelte" ;
7578 const { open } = getContext (" simple-modal" );
7679
80+ // RPC server configuration for transaction submission
81+ const rpcUrl = " https://soroban-testnet.stellar.org" ;
82+ const server = new Server (rpcUrl);
83+
84+ // Local submit function to send transactions using RPC
85+ const submit = async (transaction ) => {
86+ try {
87+ await server .sendTransaction (transaction);
88+ } catch (err) {
89+ throw error (400 , {
90+ // @ts-ignore
91+ message: ` ${ err .response ? .title } - ${err .response ? .data .extras .result_codes }` ,
92+ });
93+ }
94+ };
95+
7796 // Define some component variables that will be used throughout the page
7897 let addAsset = "";
7998 let customAssetCode = "";
You can’t perform that action at this time.
0 commit comments