diff --git a/examples/src/standard-nft/test-approval-receiver.ts b/examples/src/standard-nft/test-approval-receiver.ts index 8c614091e..640737c14 100644 --- a/examples/src/standard-nft/test-approval-receiver.ts +++ b/examples/src/standard-nft/test-approval-receiver.ts @@ -6,6 +6,8 @@ import { PromiseOrValue, assert, call, + bytes, + serialize, } from "near-sdk-js"; import { AccountId } from "near-sdk-js"; import { NonFungibleTokenApprovalReceiver } from "near-contract-standards/lib/non_fungible_token/approval/approval_receiver"; @@ -15,7 +17,7 @@ const PROMISE_CALL = 20_000_000_000_000n; const GAS_FOR_NFT_ON_APPROVE = BASE_GAS + PROMISE_CALL; interface ValueReturnInterface { - ok_go(msg: string): PromiseOrValue; + ok_go({ msg }: { msg: string }): PromiseOrValue; } @NearBindgen({ requireInit: true }) @@ -56,7 +58,7 @@ export class ApprovalReceiver const account_id = near.currentAccountId(); return NearPromise.new(account_id).functionCall( "ok_go", - JSON.stringify(msg), + bytes(serialize({ msg })), 0n, prepaid_gas - GAS_FOR_NFT_ON_APPROVE ); @@ -65,7 +67,7 @@ export class ApprovalReceiver } @call({}) - ok_go(msg: string): PromiseOrValue { + ok_go({ msg }: { msg: string }): PromiseOrValue { near.log(`in ok_go, msg=${msg}`); return msg; } diff --git a/examples/src/standard-nft/test-token-receiver.ts b/examples/src/standard-nft/test-token-receiver.ts index 9d4faf400..40433aa64 100644 --- a/examples/src/standard-nft/test-token-receiver.ts +++ b/examples/src/standard-nft/test-token-receiver.ts @@ -7,6 +7,8 @@ import { NearBindgen, NearPromise, PromiseOrValue, + bytes, + serialize, } from "near-sdk-js"; import { AccountId } from "near-sdk-js"; @@ -15,7 +17,7 @@ const PROMISE_CALL = 10_000_000_000_000n; const GAS_FOR_NFT_ON_TRANSFER = BASE_GAS + PROMISE_CALL; interface ValueReturnInterface { - ok_go(return_it: boolean): PromiseOrValue; + ok_go({ return_it }: { return_it: boolean }): PromiseOrValue; } @NearBindgen({ requireInit: true }) @@ -64,7 +66,7 @@ export class TokenReceiver const account_id = near.currentAccountId(); return NearPromise.new(account_id).functionCall( "ok_go", - JSON.stringify(true), + bytes(serialize({ return_it: true })), 0n, prepaid_gas - GAS_FOR_NFT_ON_TRANSFER ); @@ -76,7 +78,7 @@ export class TokenReceiver const account_id = near.currentAccountId(); return NearPromise.new(account_id).functionCall( "ok_go", - JSON.stringify(false), + bytes(serialize({ return_it: false })), 0n, prepaid_gas - GAS_FOR_NFT_ON_TRANSFER ); @@ -87,7 +89,7 @@ export class TokenReceiver } @call({}) - ok_go(return_it: boolean): PromiseOrValue { + ok_go({ return_it }: { return_it: boolean }): PromiseOrValue { near.log(`in ok_go, return_it=${return_it}`); return return_it; }