Created
April 17, 2021 21:00
-
-
Save mattlockyer/39e70070fa1b51d4a9b31fadae99052f to your computer and use it in GitHub Desktop.
Revisions
-
mattlockyer created this gist
Apr 17, 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,16 @@ import * as nearAPI from 'near-api-js'; const { Account, KeyPair, } = nearAPI; // near is your current near connection instance (somewhere in your app init) export const getAccessKeyAccount = (near, accountId, secretKey) => { const keyPair = KeyPair.fromString(secretKey); near.connection.signer.keyStore.setKey(near.config.networkId, accountId, keyPair); const account = new Account(near.connection, accountId); return account; };