Skip to content

Commit

Permalink
npm run format
Browse files Browse the repository at this point in the history
  • Loading branch information
algorandskiy committed Jan 10, 2025
1 parent 4b0eabc commit 76c2c51
Show file tree
Hide file tree
Showing 93 changed files with 1,473 additions and 1,422 deletions.
4 changes: 2 additions & 2 deletions examples/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ async function main() {
const msigWithFirstSig = algosdk.signMultisigTransaction(
msigTxn,
multiSigParams,
signerAccounts[0].sk
signerAccounts[0].sk,
).blob;

// Subsequent signatures use appendSignMultisigTransaction
const msigWithSecondSig = algosdk.appendSignMultisigTransaction(
msigWithFirstSig,
multiSigParams,
signerAccounts[1].sk
signerAccounts[1].sk,
).blob;

await client.sendRawTransaction(msigWithSecondSig).do();
Expand Down
30 changes: 15 additions & 15 deletions examples/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ async function main() {
// define TEAL source from string or from a file
const approvalProgram = fs.readFileSync(
path.join(__dirname, '/application/approval.teal'),
'utf8'
'utf8',
);
const clearProgram = fs.readFileSync(
path.join(__dirname, '/application/clear.teal'),
'utf8'
'utf8',
);
// example: APP_SOURCE

Expand All @@ -32,15 +32,15 @@ async function main() {
.do();

const compiledApprovalProgram = new Uint8Array(
Buffer.from(approvalCompileResp.result, 'base64')
Buffer.from(approvalCompileResp.result, 'base64'),
);

const clearCompileResp = await algodClient
.compile(Buffer.from(clearProgram))
.do();

const compiledClearProgram = new Uint8Array(
Buffer.from(clearCompileResp.result, 'base64')
Buffer.from(clearCompileResp.result, 'base64'),
);
// example: APP_COMPILE

Expand Down Expand Up @@ -72,7 +72,7 @@ async function main() {
const result = await algosdk.waitForConfirmation(
algodClient,
appCreateTxn.txID().toString(),
3
3,
);
// Grab app id from confirmed transaction result
const appId = result['application-index'];
Expand All @@ -94,7 +94,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
appOptInTxn.txID().toString(),
3
3,
);
// example: APP_OPTIN

Expand All @@ -111,7 +111,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
appNoOpTxn.txID().toString(),
3
3,
);
// example: APP_NOOP

Expand All @@ -129,7 +129,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
anotherAppOptInTxn.txID().toString(),
3
3,
);

// example: APP_CALL
Expand All @@ -147,7 +147,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
simpleAddTxn.txID().toString(),
3
3,
);
// example: APP_CALL

Expand All @@ -160,7 +160,7 @@ async function main() {
const globalKey = Buffer.from(globalState.key, 'base64').toString();
// decode b64 address value with encodeAddress and Buffer
const globalValue = algosdk.encodeAddress(
Buffer.from(globalState.value.bytes, 'base64')
Buffer.from(globalState.value.bytes, 'base64'),
);

console.log(`Decoded global state - ${globalKey}: ${globalValue}`);
Expand Down Expand Up @@ -193,14 +193,14 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
appCloseOutTxn.txID().toString(),
3
3,
);
// example: APP_CLOSEOUT

// example: APP_UPDATE
const newProgram = fs.readFileSync(
path.join(__dirname, '/application/approval_refactored.teal'),
'utf8'
'utf8',
);
const compiledNewProgram = await compileProgram(algodClient, newProgram);

Expand All @@ -219,7 +219,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
appUpdateTxn.txID().toString(),
3
3,
);
// example: APP_UPDATE

Expand All @@ -236,7 +236,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
appClearTxn.txID().toString(),
3
3,
);
// example: APP_CLEAR

Expand All @@ -253,7 +253,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
appDeleteTxn.txID().toString(),
3
3,
);
// example: APP_DELETE
}
Expand Down
14 changes: 7 additions & 7 deletions examples/asa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function main() {
const result = await algosdk.waitForConfirmation(
algodClient,
txn.txID().toString(),
3
3,
);

const assetIndex = result['asset-index'];
Expand Down Expand Up @@ -79,7 +79,7 @@ async function main() {
const configResult = await algosdk.waitForConfirmation(
algodClient,
txn.txID().toString(),
3
3,
);
console.log(`Result confirmed in round: ${configResult['confirmed-round']}`);
// example: ASSET_CONFIG
Expand Down Expand Up @@ -131,7 +131,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
freezeTxn.txID().toString(),
3
3,
);
// example: ASSET_FREEZE

Expand All @@ -145,15 +145,15 @@ async function main() {
suggestedParams,
assetIndex,
amount: 1,
}
},
);

const signedClawbackTxn = clawbackTxn.signTxn(manager.privateKey);
await algodClient.sendRawTransaction(signedClawbackTxn).do();
await algosdk.waitForConfirmation(
algodClient,
clawbackTxn.txID().toString(),
3
3,
);
// example: ASSET_CLAWBACK

Expand All @@ -176,7 +176,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
optOutTxn.txID().toString(),
3
3,
);
// example: ASSET_OPT_OUT

Expand All @@ -192,7 +192,7 @@ async function main() {
await algosdk.waitForConfirmation(
algodClient,
deleteTxn.txID().toString(),
3
3,
);
// example: ASSET_DELETE
}
Expand Down
8 changes: 4 additions & 4 deletions examples/atc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ async function main() {

const approvalProgram = fs.readFileSync(
path.join(__dirname, '/calculator/approval.teal'),
'utf8'
'utf8',
);
const clearProgram = fs.readFileSync(
path.join(__dirname, '/calculator/clear.teal'),
'utf8'
'utf8',
);

const compiledApprovalProgram = await compileProgram(client, approvalProgram);
Expand All @@ -44,7 +44,7 @@ async function main() {
const response = await algosdk.waitForConfirmation(
client,
createTxn.txID().toString(),
3
3,
);
const appIndex = response['application-index'];

Expand All @@ -54,7 +54,7 @@ async function main() {

// example: ATC_CONTRACT_INIT
const abi = JSON.parse(
fs.readFileSync(path.join(__dirname, '/calculator/contract.json'), 'utf8')
fs.readFileSync(path.join(__dirname, '/calculator/contract.json'), 'utf8'),
);
const contract = new algosdk.ABIContract(abi);
// example: ATC_CONTRACT_INIT
Expand Down
4 changes: 2 additions & 2 deletions examples/codec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function main() {
const txnB64 = Buffer.from(txnBytes).toString('base64');
// ...
const restoredTxn = algosdk.decodeUnsignedTransaction(
Buffer.from(txnB64, 'base64')
Buffer.from(txnB64, 'base64'),
);
console.log(restoredTxn);
// example: CODEC_TRANSACTION_UNSIGNED
Expand All @@ -55,7 +55,7 @@ async function main() {
const signedTxn = txn.signTxn(sender.privateKey);
const signedB64Txn = Buffer.from(signedTxn).toString('base64');
const restoredSignedTxn = algosdk.decodeSignedTransaction(
Buffer.from(signedB64Txn, 'base64')
Buffer.from(signedB64Txn, 'base64'),
);
console.log(restoredSignedTxn);
// example: CODEC_TRANSACTION_SIGNED
Expand Down
9 changes: 6 additions & 3 deletions examples/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ async function main() {

const contract = new algosdk.ABIContract(
JSON.parse(
fs.readFileSync(path.join(__dirname, '/calculator/contract.json'), 'utf8')
)
fs.readFileSync(
path.join(__dirname, '/calculator/contract.json'),
'utf8',
),
),
);

// example: DEBUG_DRYRUN_DUMP
Expand All @@ -35,7 +38,7 @@ async function main() {
});

const signedTxns = (await atc.gatherSignatures()).map((stxn) =>
algosdk.decodeSignedTransaction(stxn)
algosdk.decodeSignedTransaction(stxn),
);

const dryrunRequest = await algosdk.createDryrun({
Expand Down
8 changes: 4 additions & 4 deletions examples/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function getIndexerClient(): void {
const indexerClient = new algosdk.Indexer(
indexerToken,
indexerServer,
indexerPort
indexerPort,
);
// example: INDEXER_CREATE_CLIENT

Expand Down Expand Up @@ -77,7 +77,7 @@ async function main() {
const result = await algosdk.waitForConfirmation(
client,
txn.txID().toString(),
3
3,
);

// ensure indexer is caught up
Expand All @@ -92,8 +92,8 @@ async function main() {
`Transactions with note prefix "Hello" ${JSON.stringify(
txnsWithNotePrefix,
undefined,
2
)}`
2,
)}`,
);
// example: INDEXER_PREFIX_SEARCH
}
Expand Down
6 changes: 3 additions & 3 deletions examples/kmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function main() {
walletName,
password,
masterDerivationKey,
driver
driver,
);
const walletID = wallet.wallet.id;
console.log('Created wallet:', walletID);
Expand Down Expand Up @@ -59,7 +59,7 @@ async function main() {
console.log('Account: ', newAccount.addr);
const importedAccount = await kmdClient.importKey(
wallethandle,
newAccount.sk
newAccount.sk,
);
console.log('Account successfully imported: ', importedAccount);
// example: KMD_IMPORT_ACCOUNT
Expand All @@ -72,7 +72,7 @@ async function main() {
'testWallet2',
'testpassword',
exportedMDK,
'sqlite'
'sqlite',
);
const recoeveredWalletID = recoveredWallet.wallet.id;

Expand Down
10 changes: 5 additions & 5 deletions examples/lsig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ async function main() {

// example: LSIG_INIT
let smartSig = new algosdk.LogicSig(
new Uint8Array(Buffer.from(b64program, 'base64'))
new Uint8Array(Buffer.from(b64program, 'base64')),
);
// example: LSIG_INIT

// example: LSIG_PASS_ARGS
const args = [Buffer.from('This is an argument!')];
smartSig = new algosdk.LogicSig(
new Uint8Array(Buffer.from(b64program, 'base64')),
args
args,
);
// example: LSIG_PASS_ARGS

Expand All @@ -49,7 +49,7 @@ async function main() {
await algosdk.waitForConfirmation(
client,
fundSmartSigTxn.txID().toString(),
3
3,
);

// example: LSIG_SIGN_FULL
Expand All @@ -62,7 +62,7 @@ async function main() {

const signedSmartSigTxn = algosdk.signLogicSigTransactionObject(
smartSigTxn,
smartSig
smartSig,
);

await client.sendRawTransaction(signedSmartSigTxn.blob).do();
Expand All @@ -85,7 +85,7 @@ async function main() {
// use signLogicSigTransactionObject instead of the typical Transaction.signTxn function
const signedDelegatedTxn = algosdk.signLogicSigTransactionObject(
delegatedTxn,
smartSig
smartSig,
);

await client.sendRawTransaction(signedDelegatedTxn.blob).do();
Expand Down
Loading

0 comments on commit 76c2c51

Please sign in to comment.