Skip to content
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

Fix examples #101

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/javascript/simple_transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const example = async () => {
console.log("This example will create two accounts (Alice and Bob), fund them, and transfer between them.");

// Setup the client
const sdk = new aptos.Aptos();
const config = new aptos.AptosConfig({ network: aptos.Network.DEVNET });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is taking in the obj as param anymore? And default is devnet already?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does and always is. This is a configuration object.
Yes devnet is default but i think it helps to show the usage of the config option

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh I see, so its taking in AptosSettings as an object.

const sdk = new aptos.Aptos(config);

// Create two accounts
let alice = aptos.Account.generate({ scheme: 0 });
Expand Down Expand Up @@ -70,7 +71,7 @@ const example = async () => {
sender: alice.accountAddress.toString(),
data: {
function: "0x1::coin::transfer",
type_arguments: [new aptos.TypeTagStruct(aptos.StructTag.fromString(APTOS_COIN))],
typeArguments: [new aptos.TypeTagStruct(aptos.StructTag.fromString(APTOS_COIN))],
arguments: [aptos.AccountAddress.fromHexInput(bob.accountAddress.toString()), new aptos.U64(TRANSFER_AMOUNT)],
},
});
Expand Down
6 changes: 3 additions & 3 deletions examples/typescript/multi_agent_transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ const example = async () => {
});

// Alice signs
let aliceSignature = aptos.transactionSubmission.signTransaction({ signer: alice, transaction: transferTxn });
let aliceSignature = aptos.signTransaction({ signer: alice, transaction: transferTxn });

// Bob signs
let bobSignature = aptos.transactionSubmission.signTransaction({ signer: bob, transaction: transferTxn });
let bobSignature = aptos.signTransaction({ signer: bob, transaction: transferTxn });

const pendingTransferTxn = await aptos.transactionSubmission.submitTransaction({
const pendingTransferTxn = await aptos.submitTransaction({
transaction: transferTxn,
senderAuthenticator: aliceSignature,
secondarySignerAuthenticators: {
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/simple_sponsored_transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const example = async () => {
});

console.log(`Submitted transaction: ${committedTxn.hash}`);
const txn = await aptos.waitForTransaction({ txnHash: committedTxn.hash });
const txn = await aptos.waitForTransaction({ transactionHash: committedTxn.hash });
const gasUsed = (txn as UserTransactionResponse).gas_used;
await sleep(500);
console.log("\n=== Balances after transfer ===\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/simple_transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const example = async () => {
if (bobBalance !== BOB_INITIAL_BALANCE) throw new Error("Bob's balance is incorrect");

// Transfer between users
const txn = await aptos.transactionSubmission.generateTransaction({
const txn = await aptos.generateTransaction({
sender: alice.accountAddress.toString(),
data: {
function: "0x1::coin::transfer",
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/transfer_coin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const example = async () => {
amount: TRANSFER_AMOUNT,
});
const pendingTxn = await aptos.signAndSubmitTransaction({ signer: alice, transaction });
const response = await aptos.waitForTransaction({ txnHash: pendingTxn.hash });
const response = await aptos.waitForTransaction({ transactionHash: pendingTxn.hash });
console.log(`Committed transaction: ${response.hash}`);

console.log("\n=== Balances after transfer ===\n");
Expand Down
Loading