From 04def349bc6501a40e6b33475e2a665e32f4b56c Mon Sep 17 00:00:00 2001 From: Aniket Sharma Date: Thu, 21 Aug 2025 12:12:34 +0530 Subject: [PATCH] fix: examples --- examples/send-btc.ts | 3 ++- examples/send-eth.ts | 4 ++-- examples/send-sol.ts | 3 ++- examples/send-sui.ts | 4 +--- examples/send-xrp.ts | 3 ++- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/send-btc.ts b/examples/send-btc.ts index 12fe79d..983f354 100644 --- a/examples/send-btc.ts +++ b/examples/send-btc.ts @@ -4,6 +4,7 @@ import { connect } from 'near-api-js' import { getTransactionLastResult } from '@near-js/utils' import { Action } from '@near-js/transactions' import { contracts, chainAdapters } from 'chainsig.js' +import { createAction } from '@near-wallet-selector/wallet-utils' import dotenv from 'dotenv' import { KeyPairString } from '@near-js/crypto' @@ -84,7 +85,7 @@ async function main() { const transactions = walletSelectorTransactions.map((tx) => { return { receiverId: tx.receiverId, - actions: tx.actions, + actions: tx.actions.map((a) => createAction(a)), } satisfies { receiverId: string; actions: Action[] } }) diff --git a/examples/send-eth.ts b/examples/send-eth.ts index ce0c8fb..b89e994 100644 --- a/examples/send-eth.ts +++ b/examples/send-eth.ts @@ -6,7 +6,7 @@ import { Action } from '@near-js/transactions' import { contracts, chainAdapters } from 'chainsig.js' import { createPublicClient, http } from 'viem' import { sepolia } from 'viem/chains' - +import { createAction } from '@near-wallet-selector/wallet-utils' import dotenv from 'dotenv' import { KeyPairString } from '@near-js/crypto' @@ -87,7 +87,7 @@ async function main() { const transactions = walletSelectorTransactions.map((tx) => { return { receiverId: tx.receiverId, - actions: tx.actions, + actions: tx.actions.map((a) => createAction(a)), } satisfies { receiverId: string; actions: Action[] } }) diff --git a/examples/send-sol.ts b/examples/send-sol.ts index 126ffc9..99be3aa 100644 --- a/examples/send-sol.ts +++ b/examples/send-sol.ts @@ -6,6 +6,7 @@ import { Action } from '@near-js/transactions' import { contracts, chainAdapters } from 'chainsig.js' import { createPublicClient, http } from 'viem' import { sepolia } from 'viem/chains' +import { createAction } from '@near-wallet-selector/wallet-utils' import { Connection as SolanaConnection } from '@solana/web3.js' @@ -85,7 +86,7 @@ async function main() { const transactions = walletSelectorTransactions.map((tx) => { return { receiverId: tx.receiverId, - actions: tx.actions, + actions: tx.actions.map((a) => createAction(a)), } satisfies { receiverId: string; actions: Action[] } }) diff --git a/examples/send-sui.ts b/examples/send-sui.ts index 909dca6..9bcb23e 100644 --- a/examples/send-sui.ts +++ b/examples/send-sui.ts @@ -83,11 +83,9 @@ const signature = await contract.sign({ const results = [] for (const tx of walletSelectorTransactions) { - const actions = tx.actions - const result = await account.signAndSendTransaction({ receiverId: tx.receiverId, - actions, + actions: tx.actions, }) // @ts-ignore - Type mismatch between @near-js package versions diff --git a/examples/send-xrp.ts b/examples/send-xrp.ts index d874a55..c23c867 100644 --- a/examples/send-xrp.ts +++ b/examples/send-xrp.ts @@ -4,6 +4,7 @@ import { connect } from 'near-api-js' import { getTransactionLastResult } from '@near-js/utils' import { Action } from '@near-js/transactions' import { contracts, chainAdapters } from 'chainsig.js' +import { createAction } from '@near-wallet-selector/wallet-utils' import dotenv from 'dotenv' @@ -86,7 +87,7 @@ async function main() { const transactions = walletSelectorTransactions.map((tx) => { return { receiverId: tx.receiverId, - actions: tx.actions, + actions: tx.actions.map((a) => createAction(a)), } satisfies { receiverId: string; actions: Action[] } })