-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add account query tests #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the one name so it differs
// TODO | ||
// add account getTransactions tests once sdk v2 supports faucet (which needs transaction operation support) | ||
import { Account, Aptos, AptosConfig, Network } from "../../../src"; | ||
import { U64 } from "../../../src/bcs/serializable/move-primitives"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the exports this should all collapse! Hopefully everything will be easily accessible from one path.
test("it fetches account transactions", async () => { | ||
const config = new AptosConfig({ network: Network.LOCAL }); | ||
const aptos = new Aptos(config); | ||
const senderAccount = Account.generate({ scheme: SigningScheme.Ed25519 }); | ||
await aptos.fundAccount({ accountAddress: senderAccount.accountAddress.toString(), amount: 1000000000 }); | ||
const bob = Account.generate({ scheme: SigningScheme.Ed25519 }); | ||
const rawTxn = await aptos.generateTransaction({ | ||
sender: senderAccount.accountAddress.toString(), | ||
data: { | ||
function: "0x1::aptos_account::transfer", | ||
type_arguments: [], | ||
arguments: [bob.accountAddress, new U64(10)], | ||
}, | ||
}); | ||
const authenticator = aptos.signTransaction({ | ||
signer: senderAccount, | ||
transaction: rawTxn, | ||
}); | ||
const response = await aptos.submitTransaction({ | ||
transaction: rawTxn, | ||
senderAuthenticator: authenticator, | ||
}); | ||
const txn = await aptos.waitForTransaction({ txnHash: response.hash }); | ||
const accountTransactions = await aptos.getAccountTransactions({ | ||
accountAddress: senderAccount.accountAddress.toString(), | ||
}); | ||
expect(accountTransactions[0]).toStrictEqual(txn); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should put some of this stuff in a common place so that it can be a little more legible / add more white space
50a7894
to
82b5b3c
Compare
Description
Add missing account query tests, a better test framework to come after
https://aptos-org.slack.com/archives/C04339KQNUC/p1697063710300629
Test Plan
Related Links