Created
June 5, 2021 00:03
-
-
Save mattlockyer/c0bbcc738bcd5891b0a95bd4b6514d39 to your computer and use it in GitHub Desktop.
Revisions
-
mattlockyer created this gist
Jun 5, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ // new near instance (for NodeJS use InMemoryKeyStore) // do this once somewhere when app "mounts" or loads const near = new Near({ networkId, nodeUrl, walletUrl, deps: { keyStore: new keyStores.BrowserLocalStorageKeyStore() }, }); const account = new Account(near.connection, [ACCOUNT_ID]); // or use walletAccount const wallet = new WalletAccount(near); // now with either "wallet" or "account" you can call methods of your contract! await account.viewFunction(contractId, methodName, { ... args ... }); await account.functionCall({ contractId: ..., methodName: ..., args: { ... }, gas: ..., attachedDeposit: ... });