Skip to content

Commit

Permalink
migrate examples to not use top-level JSON values
Browse files Browse the repository at this point in the history
  • Loading branch information
itegulov committed Dec 2, 2022
1 parent 7aeede7 commit 588bef6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions examples/src/standard-nft/test-approval-receiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ 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<string>;
ok_go({ msg }: { msg: string }): PromiseOrValue<string>;
}

@NearBindgen({ requireInit: true })
export class ApprovalReceiver
implements NonFungibleTokenApprovalReceiver, ValueReturnInterface
{
implements NonFungibleTokenApprovalReceiver, ValueReturnInterface {
public non_fungible_token_account_id: AccountId;

constructor() {
Expand Down Expand Up @@ -65,7 +64,7 @@ export class ApprovalReceiver
}

@call({})
ok_go(msg: string): PromiseOrValue<string> {
ok_go({ msg }: { msg: string }): PromiseOrValue<string> {
near.log(`in ok_go, msg=${msg}`);
return msg;
}
Expand Down
7 changes: 3 additions & 4 deletions examples/src/standard-nft/test-token-receiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ 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<boolean>;
ok_go({ return_it }: { return_it: boolean }): PromiseOrValue<boolean>;
}

@NearBindgen({ requireInit: true })
export class TokenReceiver
implements NonFungibleTokenReceiver, ValueReturnInterface
{
implements NonFungibleTokenReceiver, ValueReturnInterface {
public non_fungible_token_account_id: AccountId;

constructor() {
Expand Down Expand Up @@ -87,7 +86,7 @@ export class TokenReceiver
}

@call({})
ok_go(return_it: boolean): PromiseOrValue<boolean> {
ok_go({ return_it }: { return_it: boolean }): PromiseOrValue<boolean> {
near.log(`in ok_go, return_it=${return_it}`);
return return_it;
}
Expand Down

0 comments on commit 588bef6

Please sign in to comment.