Skip to content

Commit

Permalink
chore: run formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Akhterov <[email protected]>
  • Loading branch information
janaakhterov committed Jun 21, 2022
1 parent 686a486 commit ce97770
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 603 deletions.
43 changes: 26 additions & 17 deletions examples/scheduled-transaction-multi-sig-threshold.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ async function main() {
.setAccountMemo("3-of-4 multi-sig account")
.executeWithSigner(wallet);

const txAccountCreateReceipt = await txAccountCreate.getReceiptWithSigner(wallet);
const txAccountCreateReceipt = await txAccountCreate.getReceiptWithSigner(
wallet
);
const multiSigAccountId = txAccountCreateReceipt.accountId;
console.log(
`3-of-4 multi-sig account ID: ${multiSigAccountId.toString()}`
Expand All @@ -64,12 +66,13 @@ async function main() {

// schedule crypto transfer from multi-sig account to operator account
const txSchedule = await (
await (await new TransferTransaction()
.addHbarTransfer(multiSigAccountId, Hbar.fromTinybars(-1))
.addHbarTransfer(wallet.getAccountId(), Hbar.fromTinybars(1))
.schedule() // create schedule
.freezeWithSigner(wallet))
.sign(privateKeyList[0])
await (
await new TransferTransaction()
.addHbarTransfer(multiSigAccountId, Hbar.fromTinybars(-1))
.addHbarTransfer(wallet.getAccountId(), Hbar.fromTinybars(1))
.schedule() // create schedule
.freezeWithSigner(wallet)
).sign(privateKeyList[0])
) // add 1. signature
.executeWithSigner(wallet);

Expand All @@ -82,13 +85,16 @@ async function main() {

// add 2. signature
const txScheduleSign1 = await (
await (await new ScheduleSignTransaction()
.setScheduleId(scheduleId)
.freezeWithSigner(wallet))
.sign(privateKeyList[1])
await (
await new ScheduleSignTransaction()
.setScheduleId(scheduleId)
.freezeWithSigner(wallet)
).sign(privateKeyList[1])
).executeWithSigner(wallet);

const txScheduleSign1Receipt = await txScheduleSign1.getReceiptWithSigner(wallet);
const txScheduleSign1Receipt = await txScheduleSign1.getReceiptWithSigner(
wallet
);
console.log(
"1. ScheduleSignTransaction status: " +
txScheduleSign1Receipt.status.toString()
Expand All @@ -97,13 +103,16 @@ async function main() {

// add 3. signature to trigger scheduled tx
const txScheduleSign2 = await (
await (await new ScheduleSignTransaction()
.setScheduleId(scheduleId)
.freezeWithSigner(wallet))
.sign(privateKeyList[2])
await (
await new ScheduleSignTransaction()
.setScheduleId(scheduleId)
.freezeWithSigner(wallet)
).sign(privateKeyList[2])
).executeWithSigner(wallet);

const txScheduleSign2Receipt = await txScheduleSign2.getReceiptWithSigner(wallet);
const txScheduleSign2Receipt = await txScheduleSign2.getReceiptWithSigner(
wallet
);
console.log(
"2. ScheduleSignTransaction status: " +
txScheduleSign2Receipt.status.toString()
Expand Down
11 changes: 6 additions & 5 deletions examples/staking-example-1.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
AccountCreateTransaction,
AccountUpdateTransaction,
AccountId,
AccountInfoQuery,
Wallet,
LocalProvider,
Expand Down Expand Up @@ -73,10 +72,12 @@ async function main() {
// If this succeeds then we should no longer have a staked account ID
await (
await (
await (await new AccountUpdateTransaction()
.setAccountId(newAccountId)
.clearStakedAccountId()
.freezeWithSigner(wallet))
await (
await new AccountUpdateTransaction()
.setAccountId(newAccountId)
.clearStakedAccountId()
.freezeWithSigner(wallet)
)
// Sign the transaction with the account key
.sign(newKey)
).executeWithSigner(wallet)
Expand Down
1 change: 0 additions & 1 deletion examples/staking-example-2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
AccountCreateTransaction,
AccountId,
AccountInfoQuery,
Wallet,
LocalProvider,
Expand Down
40 changes: 22 additions & 18 deletions examples/transfer-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ async function main() {

await (
await (
await (await new TokenAssociateTransaction()
.setNodeAccountIds([resp.nodeId])
.setAccountId(newAccountId)
.setTokenIds([tokenId])
.freezeWithSigner(wallet))
.sign(newKey)
await (
await new TokenAssociateTransaction()
.setNodeAccountIds([resp.nodeId])
.setAccountId(newAccountId)
.setTokenIds([tokenId])
.freezeWithSigner(wallet)
).sign(newKey)
).executeWithSigner(wallet)
).getReceiptWithSigner(wallet);

Expand Down Expand Up @@ -101,17 +102,19 @@ async function main() {
).getReceiptWithSigner(wallet);

console.log(
`Sent 10 tokens from account ${wallet.getAccountId().toString()} to account ${newAccountId.toString()} on token ${tokenId.toString()}`
`Sent 10 tokens from account ${wallet
.getAccountId()
.toString()} to account ${newAccountId.toString()} on token ${tokenId.toString()}`
);

const balances = await new AccountBalanceQuery()
.setAccountId(wallet.getAccountId())
.executeWithSigner(wallet);

console.log(
`Token balances for ${wallet.getAccountId().toString()} are ${balances.tokens
.toString()
.toString()}`
`Token balances for ${wallet
.getAccountId()
.toString()} are ${balances.tokens.toString().toString()}`
);

await (
Expand All @@ -136,14 +139,15 @@ async function main() {

await (
await (
await (await new AccountDeleteTransaction()
.setNodeAccountIds([resp.nodeId])
.setAccountId(newAccountId)
.setTransferAccountId(wallet.getAccountId())
.setTransactionId(TransactionId.generate(newAccountId))
.setMaxTransactionFee(new Hbar(1))
.freezeWithSigner(wallet))
.sign(newKey)
await (
await new AccountDeleteTransaction()
.setNodeAccountIds([resp.nodeId])
.setAccountId(newAccountId)
.setTransferAccountId(wallet.getAccountId())
.setTransactionId(TransactionId.generate(newAccountId))
.setMaxTransactionFee(new Hbar(1))
.freezeWithSigner(wallet)
).sign(newKey)
).executeWithSigner(wallet)
).getReceiptWithSigner(wallet);

Expand Down
Loading

0 comments on commit ce97770

Please sign in to comment.