Skip to content

Commit 0bb29af

Browse files
Copilottamirms
andcommitted
Remove rpcQueries import and define local submit function in manage-trust tutorial
Co-authored-by: tamirms <1445829+tamirms@users.noreply.github.com>
1 parent 4d7e366 commit 0bb29af

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/build/apps/example-application-tutorial/manage-trust.mdx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff 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 = "";

0 commit comments

Comments
 (0)