Created
March 4, 2021 16:37
-
-
Save blake41/1a09c6ac06246ebd14b0a640b3d77290 to your computer and use it in GitHub Desktop.
This file contains 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 characters
async function connect() { | |
// Initializing connection to the NEAR node. | |
window.near = await nearAPI.connect(Object.assign(nearConfig, { deps: { keyStore: new nearAPI.keyStores.BrowserLocalStorageKeyStore() }})); | |
// Needed to access wallet login | |
window.walletAccount = new nearAPI.WalletConnection(window.near); | |
// Initializing our contract APIs by contract name and configuration. | |
window.contract = await near.loadContract(nearConfig.contractName, { | |
viewMethods: ['getCounter'], | |
changeMethods: ['incrementCounter', 'decrementCounter', 'resetCounter'], | |
sender: window.walletAccount.getAccountId() | |
}); | |
} | |
async function displayTransactions() { | |
var account = await near.account(window.walletAccount.getAccountId()) | |
var details = await account.getAccountDetails() | |
console.log(details) | |
var state = await account.state() | |
console.log(console.log(state)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment