Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions lib/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ async function invoke(
// Submit the signed XDR directly via the RPC JSON-RPC endpoint.
// We bypass TransactionBuilder.fromXDR because Freighter may return a
// FeeBumpTransaction envelope (type 4) which fromXDR can't handle.
const rpcResponse = await fetchWithRetry(NETWORK.rpcUrl, {
const rpcResponse = await fetch(config.rpcUrl, {
const rpcResponse = await fetchWithRetry(config.rpcUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
Expand Down Expand Up @@ -157,9 +156,7 @@ async function invoke(
while (pollStatus !== 'SUCCESS' && pollStatus !== 'FAILED') {
if (Date.now() >= pollDeadline) throw new Error('Transaction confirmation timed out after 60s')
await new Promise<void>((r) => setTimeout(r, 2000))
const pollRes = await fetchWithRetry(NETWORK.rpcUrl, {
await new Promise((r) => setTimeout(r, 2000))
const pollRes = await fetch(config.rpcUrl, {
const pollRes = await fetchWithRetry(config.rpcUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
Expand Down Expand Up @@ -311,9 +308,8 @@ export async function createStream(

// Step 1: approve the streaming contract to pull `totalAmount` from the sender.
// The allowance needs to outlast the simulation ledger — set it to current + 500 ledgers.
const currentLedger = (await withRetry(() => server.getLatestLedger())).sequence
const server = getServer(network)
const currentLedger = (await server.getLatestLedger()).sequence
const currentLedger = (await withRetry(() => server.getLatestLedger())).sequence
const expirationLedger = currentLedger + 500

await invoke(
Expand Down Expand Up @@ -352,6 +348,7 @@ export async function createStream(
'create_stream',
[new Address(sender).toScVal(), params],
sender,
config.streamContractId,
)

// SDK v13 can't parse TransactionMetaV4 (protocol 22+) so returnValue is void.
Expand Down
Loading