algosdk 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/abi/abi_type.js +6 -5
- package/dist/cjs/abi/abi_type.js.map +1 -1
- package/dist/cjs/bid.js +6 -5
- package/dist/cjs/bid.js.map +1 -1
- package/dist/cjs/client/client.js +4 -3
- package/dist/cjs/client/client.js.map +1 -1
- package/dist/cjs/client/kmd.js +12 -11
- package/dist/cjs/client/kmd.js.map +1 -1
- package/dist/cjs/client/urlTokenBaseHTTPClient.js +2 -1
- package/dist/cjs/client/urlTokenBaseHTTPClient.js.map +1 -1
- package/dist/cjs/client/v2/algod/algod.js +32 -0
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/compile.js +2 -1
- package/dist/cjs/client/v2/algod/compile.js.map +1 -1
- package/dist/cjs/client/v2/algod/disassemble.js +46 -0
- package/dist/cjs/client/v2/algod/disassemble.js.map +1 -0
- package/dist/cjs/client/v2/algod/dryrun.js +2 -1
- package/dist/cjs/client/v2/algod/dryrun.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxByName.js +2 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxByName.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +141 -21
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/algod/sendRawTransaction.js +2 -1
- package/dist/cjs/client/v2/algod/sendRawTransaction.js.map +1 -1
- package/dist/cjs/client/v2/algod/simulateTransaction.js +88 -0
- package/dist/cjs/client/v2/algod/simulateTransaction.js.map +1 -0
- package/dist/cjs/client/v2/basemodel.js +3 -2
- package/dist/cjs/client/v2/basemodel.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupAccountTransactions.js +2 -1
- package/dist/cjs/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
- package/dist/cjs/client/v2/indexer/lookupApplicationBoxByIDandName.js +2 -1
- package/dist/cjs/client/v2/indexer/lookupApplicationBoxByIDandName.js.map +1 -1
- package/dist/cjs/client/v2/indexer/models/types.js +39 -38
- package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
- package/dist/cjs/composer.js +75 -23
- package/dist/cjs/composer.js.map +1 -1
- package/dist/cjs/dryrun.js +6 -5
- package/dist/cjs/dryrun.js.map +1 -1
- package/dist/cjs/encoding/address.js +2 -1
- package/dist/cjs/encoding/address.js.map +1 -1
- package/dist/cjs/encoding/bigint.js +2 -1
- package/dist/cjs/encoding/bigint.js.map +1 -1
- package/dist/cjs/encoding/encoding.js +14 -3
- package/dist/cjs/encoding/encoding.js.map +1 -1
- package/dist/cjs/encoding/uint64.js +14 -8
- package/dist/cjs/encoding/uint64.js.map +1 -1
- package/dist/cjs/group.js +6 -5
- package/dist/cjs/group.js.map +1 -1
- package/dist/cjs/logicsig.js +22 -8
- package/dist/cjs/logicsig.js.map +1 -1
- package/dist/cjs/main.js +7 -5
- package/dist/cjs/main.js.map +1 -1
- package/dist/cjs/multisig.js +6 -5
- package/dist/cjs/multisig.js.map +1 -1
- package/dist/cjs/signer.js +17 -1
- package/dist/cjs/signer.js.map +1 -1
- package/dist/cjs/transaction.js +81 -64
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/cjs/types/transactions/encoded.js +0 -3
- package/dist/cjs/types/transactions/encoded.js.map +1 -1
- package/dist/cjs/utils/utils.js +5 -1
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/esm/abi/abi_type.js +1 -0
- package/dist/esm/abi/abi_type.js.map +1 -1
- package/dist/esm/bid.js +1 -0
- package/dist/esm/bid.js.map +1 -1
- package/dist/esm/client/client.js +1 -0
- package/dist/esm/client/client.js.map +1 -1
- package/dist/esm/client/kmd.js +1 -0
- package/dist/esm/client/kmd.js.map +1 -1
- package/dist/esm/client/urlTokenBaseHTTPClient.js +1 -0
- package/dist/esm/client/urlTokenBaseHTTPClient.js.map +1 -1
- package/dist/esm/client/v2/algod/algod.js +32 -0
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/compile.js +1 -0
- package/dist/esm/client/v2/algod/compile.js.map +1 -1
- package/dist/esm/client/v2/algod/disassemble.js +38 -0
- package/dist/esm/client/v2/algod/disassemble.js.map +1 -0
- package/dist/esm/client/v2/algod/dryrun.js +1 -0
- package/dist/esm/client/v2/algod/dryrun.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxByName.js +1 -0
- package/dist/esm/client/v2/algod/getApplicationBoxByName.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +117 -0
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/algod/sendRawTransaction.js +1 -0
- package/dist/esm/client/v2/algod/sendRawTransaction.js.map +1 -1
- package/dist/esm/client/v2/algod/simulateTransaction.js +57 -0
- package/dist/esm/client/v2/algod/simulateTransaction.js.map +1 -0
- package/dist/esm/client/v2/basemodel.js +1 -0
- package/dist/esm/client/v2/basemodel.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupAccountTransactions.js +1 -0
- package/dist/esm/client/v2/indexer/lookupAccountTransactions.js.map +1 -1
- package/dist/esm/client/v2/indexer/lookupApplicationBoxByIDandName.js +1 -0
- package/dist/esm/client/v2/indexer/lookupApplicationBoxByIDandName.js.map +1 -1
- package/dist/esm/client/v2/indexer/models/types.js +1 -0
- package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
- package/dist/esm/composer.js +75 -23
- package/dist/esm/composer.js.map +1 -1
- package/dist/esm/dryrun.js +1 -0
- package/dist/esm/dryrun.js.map +1 -1
- package/dist/esm/encoding/address.js +1 -0
- package/dist/esm/encoding/address.js.map +1 -1
- package/dist/esm/encoding/bigint.js +1 -0
- package/dist/esm/encoding/bigint.js.map +1 -1
- package/dist/esm/encoding/encoding.js +12 -2
- package/dist/esm/encoding/encoding.js.map +1 -1
- package/dist/esm/encoding/uint64.js +14 -8
- package/dist/esm/encoding/uint64.js.map +1 -1
- package/dist/esm/group.js +1 -0
- package/dist/esm/group.js.map +1 -1
- package/dist/esm/logicsig.js +13 -0
- package/dist/esm/logicsig.js.map +1 -1
- package/dist/esm/main.js +2 -1
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/multisig.js +1 -0
- package/dist/esm/multisig.js.map +1 -1
- package/dist/esm/signer.js +15 -0
- package/dist/esm/signer.js.map +1 -1
- package/dist/esm/transaction.js +16 -0
- package/dist/esm/transaction.js.map +1 -1
- package/dist/esm/types/transactions/encoded.js +0 -3
- package/dist/esm/types/transactions/encoded.js.map +1 -1
- package/dist/esm/utils/utils.js +5 -1
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/types/client/v2/algod/algod.d.ts +28 -0
- package/dist/types/client/v2/algod/disassemble.d.ts +20 -0
- package/dist/types/client/v2/algod/models/types.d.ts +103 -0
- package/dist/types/client/v2/algod/simulateTransaction.d.ts +19 -0
- package/dist/types/client/v2/basemodel.d.ts +0 -3
- package/dist/types/composer.d.ts +35 -2
- package/dist/types/encoding/encoding.d.ts +7 -0
- package/dist/types/logicsig.d.ts +8 -0
- package/dist/types/main.d.ts +1 -1
- package/dist/types/signer.d.ts +5 -0
- package/dist/types/transaction.d.ts +9 -0
- package/dist/types/types/transactions/builder.d.ts +1 -1
- package/dist/types/types/transactions/encoded.d.ts +1 -1
- package/dist/types/types/utils.d.ts +1 -1
- package/package.json +2 -3
- package/src/abi/abi_type.ts +1 -0
- package/src/bid.ts +1 -0
- package/src/client/client.ts +1 -0
- package/src/client/kmd.ts +1 -0
- package/src/client/urlTokenBaseHTTPClient.ts +1 -0
- package/src/client/v2/algod/algod.ts +34 -0
- package/src/client/v2/algod/compile.ts +1 -0
- package/src/client/v2/algod/disassemble.ts +46 -0
- package/src/client/v2/algod/dryrun.ts +1 -0
- package/src/client/v2/algod/getApplicationBoxByName.ts +1 -0
- package/src/client/v2/algod/models/types.ts +223 -0
- package/src/client/v2/algod/sendRawTransaction.ts +1 -0
- package/src/client/v2/algod/simulateTransaction.ts +74 -0
- package/src/client/v2/basemodel.ts +2 -0
- package/src/client/v2/indexer/lookupAccountTransactions.ts +1 -0
- package/src/client/v2/indexer/lookupApplicationBoxByIDandName.ts +1 -0
- package/src/client/v2/indexer/models/types.ts +1 -0
- package/src/composer.ts +130 -34
- package/src/dryrun.ts +1 -0
- package/src/encoding/address.ts +1 -0
- package/src/encoding/bigint.ts +2 -0
- package/src/encoding/encoding.ts +13 -2
- package/src/encoding/uint64.ts +16 -10
- package/src/group.ts +1 -0
- package/src/logicsig.ts +24 -0
- package/src/main.ts +2 -0
- package/src/multisig.ts +1 -0
- package/src/signer.ts +18 -1
- package/src/transaction.ts +19 -0
- package/src/types/transactions/builder.ts +4 -4
- package/src/types/transactions/encoded.ts +2 -0
- package/src/types/utils.ts +1 -1
- package/src/utils/utils.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,aAAa,CAAC;AAC/C,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAE/C,MAAM,OAAO,GAAG,oBAAoB,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAM9E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,OAAqB;IAC1D,MAAM,WAAW,GACf,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC;IAC7E,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QACrC,IACE,KAAK,IAAI,IAAI;YACb,OAAO,KAAK,KAAK,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O,CAAC,QAAQ,KAAK,QAAQ;QACpC,aAAa;QACb,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,CAC7C,CAAC;AACJ,CAAC"}
|
|
@@ -27,6 +27,8 @@ import { BaseHTTPClient } from '../../baseHTTPClient';
|
|
|
27
27
|
import { AlgodTokenHeader, CustomTokenHeader } from '../../urlTokenBaseHTTPClient';
|
|
28
28
|
import LightBlockHeaderProof from './lightBlockHeaderProof';
|
|
29
29
|
import StateProof from './stateproof';
|
|
30
|
+
import Disassemble from './disassemble';
|
|
31
|
+
import SimulateRawTransactions from './simulateTransaction';
|
|
30
32
|
/**
|
|
31
33
|
* Algod client connects an application to the Algorand blockchain. The algod client requires a valid algod REST endpoint IP address and algod token from an Algorand node that is connected to the network you plan to interact with.
|
|
32
34
|
*
|
|
@@ -323,6 +325,19 @@ export default class AlgodClient extends ServiceClient {
|
|
|
323
325
|
* @category POST
|
|
324
326
|
*/
|
|
325
327
|
compile(source: string | Uint8Array): Compile;
|
|
328
|
+
/**
|
|
329
|
+
* Given the program bytes, return the TEAL source code in plain text.
|
|
330
|
+
*
|
|
331
|
+
* #### Example
|
|
332
|
+
* ```typescript
|
|
333
|
+
* const bytecode = "TEAL bytecode";
|
|
334
|
+
* const disassembledSource = await algodClient.disassemble(bytecode).do();
|
|
335
|
+
* ```
|
|
336
|
+
*
|
|
337
|
+
* @remarks This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true.
|
|
338
|
+
* @param source
|
|
339
|
+
*/
|
|
340
|
+
disassemble(source: string | Uint8Array): Disassemble;
|
|
326
341
|
/**
|
|
327
342
|
* Provides debugging information for a transaction (or group).
|
|
328
343
|
*
|
|
@@ -453,4 +468,17 @@ export default class AlgodClient extends ServiceClient {
|
|
|
453
468
|
* @param round
|
|
454
469
|
*/
|
|
455
470
|
getStateProof(round: number): StateProof;
|
|
471
|
+
/**
|
|
472
|
+
* Simulate a list of a signed transaction objects being sent to the network.
|
|
473
|
+
*
|
|
474
|
+
* #### Example
|
|
475
|
+
* ```typescript
|
|
476
|
+
* const resp = await client.simulateRawTransactions([signedTxn1, signedTxn2]).do();
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2transactionssimulate)
|
|
480
|
+
* @param stxOrStxs
|
|
481
|
+
* @category POST
|
|
482
|
+
*/
|
|
483
|
+
simulateRawTransactions(stxOrStxs: Uint8Array | Uint8Array[]): SimulateRawTransactions;
|
|
456
484
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import JSONRequest from '../jsonrequest';
|
|
2
|
+
import HTTPClient from '../../client';
|
|
3
|
+
/**
|
|
4
|
+
* Sets the default header (if not previously set)
|
|
5
|
+
* @param headers - A headers object
|
|
6
|
+
*/
|
|
7
|
+
export declare function setHeaders(headers?: {}): {};
|
|
8
|
+
/**
|
|
9
|
+
* Executes disassemble
|
|
10
|
+
*/
|
|
11
|
+
export default class Disassemble extends JSONRequest {
|
|
12
|
+
private source;
|
|
13
|
+
constructor(c: HTTPClient, source: string | Uint8Array);
|
|
14
|
+
path(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Executes disassemble
|
|
17
|
+
* @param headers - A headers object
|
|
18
|
+
*/
|
|
19
|
+
do(headers?: {}): Promise<any>;
|
|
20
|
+
}
|
|
@@ -1413,6 +1413,109 @@ export declare class PostTransactionsResponse extends BaseModel {
|
|
|
1413
1413
|
});
|
|
1414
1414
|
static from_obj_for_encoding(data: Record<string, any>): PostTransactionsResponse;
|
|
1415
1415
|
}
|
|
1416
|
+
/**
|
|
1417
|
+
* Result of a transaction group simulation.
|
|
1418
|
+
*/
|
|
1419
|
+
export declare class SimulateResponse extends BaseModel {
|
|
1420
|
+
/**
|
|
1421
|
+
* The round immediately preceding this simulation. State changes through this
|
|
1422
|
+
* round were used to run this simulation.
|
|
1423
|
+
*/
|
|
1424
|
+
lastRound: number | bigint;
|
|
1425
|
+
/**
|
|
1426
|
+
* A result object for each transaction group that was simulated.
|
|
1427
|
+
*/
|
|
1428
|
+
txnGroups: SimulateTransactionGroupResult[];
|
|
1429
|
+
/**
|
|
1430
|
+
* The version of this response object.
|
|
1431
|
+
*/
|
|
1432
|
+
version: number | bigint;
|
|
1433
|
+
/**
|
|
1434
|
+
* Indicates whether the simulated transactions would have succeeded during an
|
|
1435
|
+
* actual submission. If any transaction fails or is missing a signature, this will
|
|
1436
|
+
* be false.
|
|
1437
|
+
*/
|
|
1438
|
+
wouldSucceed: boolean;
|
|
1439
|
+
/**
|
|
1440
|
+
* Creates a new `SimulateResponse` object.
|
|
1441
|
+
* @param lastRound - The round immediately preceding this simulation. State changes through this
|
|
1442
|
+
* round were used to run this simulation.
|
|
1443
|
+
* @param txnGroups - A result object for each transaction group that was simulated.
|
|
1444
|
+
* @param version - The version of this response object.
|
|
1445
|
+
* @param wouldSucceed - Indicates whether the simulated transactions would have succeeded during an
|
|
1446
|
+
* actual submission. If any transaction fails or is missing a signature, this will
|
|
1447
|
+
* be false.
|
|
1448
|
+
*/
|
|
1449
|
+
constructor({ lastRound, txnGroups, version, wouldSucceed, }: {
|
|
1450
|
+
lastRound: number | bigint;
|
|
1451
|
+
txnGroups: SimulateTransactionGroupResult[];
|
|
1452
|
+
version: number | bigint;
|
|
1453
|
+
wouldSucceed: boolean;
|
|
1454
|
+
});
|
|
1455
|
+
static from_obj_for_encoding(data: Record<string, any>): SimulateResponse;
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Simulation result for an atomic transaction group
|
|
1459
|
+
*/
|
|
1460
|
+
export declare class SimulateTransactionGroupResult extends BaseModel {
|
|
1461
|
+
/**
|
|
1462
|
+
* Simulation result for individual transactions
|
|
1463
|
+
*/
|
|
1464
|
+
txnResults: SimulateTransactionResult[];
|
|
1465
|
+
/**
|
|
1466
|
+
* If present, indicates which transaction in this group caused the failure. This
|
|
1467
|
+
* array represents the path to the failing transaction. Indexes are zero based,
|
|
1468
|
+
* the first element indicates the top-level transaction, and successive elements
|
|
1469
|
+
* indicate deeper inner transactions.
|
|
1470
|
+
*/
|
|
1471
|
+
failedAt?: (number | bigint)[];
|
|
1472
|
+
/**
|
|
1473
|
+
* If present, indicates that the transaction group failed and specifies why that
|
|
1474
|
+
* happened
|
|
1475
|
+
*/
|
|
1476
|
+
failureMessage?: string;
|
|
1477
|
+
/**
|
|
1478
|
+
* Creates a new `SimulateTransactionGroupResult` object.
|
|
1479
|
+
* @param txnResults - Simulation result for individual transactions
|
|
1480
|
+
* @param failedAt - If present, indicates which transaction in this group caused the failure. This
|
|
1481
|
+
* array represents the path to the failing transaction. Indexes are zero based,
|
|
1482
|
+
* the first element indicates the top-level transaction, and successive elements
|
|
1483
|
+
* indicate deeper inner transactions.
|
|
1484
|
+
* @param failureMessage - If present, indicates that the transaction group failed and specifies why that
|
|
1485
|
+
* happened
|
|
1486
|
+
*/
|
|
1487
|
+
constructor({ txnResults, failedAt, failureMessage, }: {
|
|
1488
|
+
txnResults: SimulateTransactionResult[];
|
|
1489
|
+
failedAt?: (number | bigint)[];
|
|
1490
|
+
failureMessage?: string;
|
|
1491
|
+
});
|
|
1492
|
+
static from_obj_for_encoding(data: Record<string, any>): SimulateTransactionGroupResult;
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Simulation result for an individual transaction
|
|
1496
|
+
*/
|
|
1497
|
+
export declare class SimulateTransactionResult extends BaseModel {
|
|
1498
|
+
/**
|
|
1499
|
+
* Details about a pending transaction. If the transaction was recently confirmed,
|
|
1500
|
+
* includes confirmation details like the round and reward details.
|
|
1501
|
+
*/
|
|
1502
|
+
txnResult: PendingTransactionResponse;
|
|
1503
|
+
/**
|
|
1504
|
+
* A boolean indicating whether this transaction is missing signatures
|
|
1505
|
+
*/
|
|
1506
|
+
missingSignature?: boolean;
|
|
1507
|
+
/**
|
|
1508
|
+
* Creates a new `SimulateTransactionResult` object.
|
|
1509
|
+
* @param txnResult - Details about a pending transaction. If the transaction was recently confirmed,
|
|
1510
|
+
* includes confirmation details like the round and reward details.
|
|
1511
|
+
* @param missingSignature - A boolean indicating whether this transaction is missing signatures
|
|
1512
|
+
*/
|
|
1513
|
+
constructor({ txnResult, missingSignature, }: {
|
|
1514
|
+
txnResult: PendingTransactionResponse;
|
|
1515
|
+
missingSignature?: boolean;
|
|
1516
|
+
});
|
|
1517
|
+
static from_obj_for_encoding(data: Record<string, any>): SimulateTransactionResult;
|
|
1518
|
+
}
|
|
1416
1519
|
/**
|
|
1417
1520
|
* Represents a state proof and its corresponding message
|
|
1418
1521
|
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import HTTPClient from '../../client';
|
|
2
|
+
import JSONRequest from '../jsonrequest';
|
|
3
|
+
import { SimulateResponse } from './models/types';
|
|
4
|
+
/**
|
|
5
|
+
* Sets the default header (if not previously set) for simulating a raw
|
|
6
|
+
* transaction.
|
|
7
|
+
* @param headers - A headers object
|
|
8
|
+
*/
|
|
9
|
+
export declare function setSimulateTransactionsHeaders(headers?: {}): {};
|
|
10
|
+
/**
|
|
11
|
+
* Simulates signed txns.
|
|
12
|
+
*/
|
|
13
|
+
export default class SimulateRawTransactions extends JSONRequest<SimulateResponse, Uint8Array> {
|
|
14
|
+
private txnBytesToPost;
|
|
15
|
+
constructor(c: HTTPClient, stxOrStxs: Uint8Array | Uint8Array[]);
|
|
16
|
+
path(): string;
|
|
17
|
+
do(headers?: {}): Promise<SimulateResponse>;
|
|
18
|
+
prepare(body: Uint8Array): SimulateResponse;
|
|
19
|
+
}
|
package/dist/types/composer.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ABIMethod, ABIValue } from './abi';
|
|
2
2
|
import Algodv2 from './client/v2/algod/algod';
|
|
3
|
+
import { SimulateResponse } from './client/v2/algod/models/types';
|
|
3
4
|
import { TransactionSigner, TransactionWithSigner } from './signer';
|
|
4
5
|
import { BoxReference, OnApplicationComplete, SuggestedParams } from './types/transactions/base';
|
|
5
6
|
export declare type ABIArgument = ABIValue | TransactionWithSigner;
|
|
@@ -74,7 +75,7 @@ export declare class AtomicTransactionComposer {
|
|
|
74
75
|
* causes the current group to exceed MAX_GROUP_SIZE, or if the provided arguments are invalid
|
|
75
76
|
* for the given method.
|
|
76
77
|
*/
|
|
77
|
-
addMethodCall({ appID, method, methodArgs, sender, suggestedParams, onComplete, approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages, boxes, note, lease, rekeyTo, signer, }: {
|
|
78
|
+
addMethodCall({ appID, method, methodArgs, sender, suggestedParams, onComplete, approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, numLocalInts, numLocalByteSlices, extraPages, appAccounts, appForeignApps, appForeignAssets, boxes, note, lease, rekeyTo, signer, }: {
|
|
78
79
|
/** The ID of the smart contract to call. Set this to 0 to indicate an application creation call. */
|
|
79
80
|
appID: number;
|
|
80
81
|
/** The method to call on the smart contract */
|
|
@@ -101,6 +102,12 @@ export declare class AtomicTransactionComposer {
|
|
|
101
102
|
numLocalByteSlices?: number;
|
|
102
103
|
/** The number of extra pages to allocate for the application's programs. Only set this if this is an application creation call. If omitted, defaults to 0. */
|
|
103
104
|
extraPages?: number;
|
|
105
|
+
/** Array of Address strings that represent external accounts supplied to this application. If accounts are provided here, the accounts specified in the method args will appear after these. */
|
|
106
|
+
appAccounts?: string[];
|
|
107
|
+
/** Array of App ID numbers that represent external apps supplied to this application. If apps are provided here, the apps specified in the method args will appear after these. */
|
|
108
|
+
appForeignApps?: number[];
|
|
109
|
+
/** Array of Asset ID numbers that represent external assets supplied to this application. If assets are provided here, the assets specified in the method args will appear after these. */
|
|
110
|
+
appForeignAssets?: number[];
|
|
104
111
|
/** The box references for this application call */
|
|
105
112
|
boxes?: BoxReference[];
|
|
106
113
|
/** The note value for this application call */
|
|
@@ -143,6 +150,23 @@ export declare class AtomicTransactionComposer {
|
|
|
143
150
|
* @returns A promise that, upon success, resolves to a list of TxIDs of the submitted transactions.
|
|
144
151
|
*/
|
|
145
152
|
submit(client: Algodv2): Promise<string[]>;
|
|
153
|
+
/**
|
|
154
|
+
* Simulates the transaction group in the network.
|
|
155
|
+
*
|
|
156
|
+
* The composer will try to sign any transactions in the group, then simulate
|
|
157
|
+
* the results.
|
|
158
|
+
* Simulating the group will not change the composer's status.
|
|
159
|
+
*
|
|
160
|
+
* @param client - An Algodv2 client
|
|
161
|
+
*
|
|
162
|
+
* @returns A promise that, upon success, resolves to an object containing an
|
|
163
|
+
* array of results containing one element for each method call transaction
|
|
164
|
+
* in this group (ABIResult[]) and the SimulateResponse object.
|
|
165
|
+
*/
|
|
166
|
+
simulate(client: Algodv2): Promise<{
|
|
167
|
+
methodResults: ABIResult[];
|
|
168
|
+
simulateResponse: SimulateResponse;
|
|
169
|
+
}>;
|
|
146
170
|
/**
|
|
147
171
|
* Send the transaction group to the network and wait until it's committed to a block. An error
|
|
148
172
|
* will be thrown if submission or execution fails.
|
|
@@ -165,4 +189,13 @@ export declare class AtomicTransactionComposer {
|
|
|
165
189
|
txIDs: string[];
|
|
166
190
|
methodResults: ABIResult[];
|
|
167
191
|
}>;
|
|
192
|
+
/**
|
|
193
|
+
* Parses a single ABI Method transaction log into a ABI result object.
|
|
194
|
+
*
|
|
195
|
+
* @param method
|
|
196
|
+
* @param methodResult
|
|
197
|
+
* @param pendingInfo
|
|
198
|
+
* @returns An ABIResult object
|
|
199
|
+
*/
|
|
200
|
+
static parseMethodResponse(method: ABIMethod, methodResult: ABIResult, pendingInfo: Record<string, any>): ABIResult;
|
|
168
201
|
}
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
* 5. Binary blob should be used for binary data and string for strings
|
|
11
11
|
* */
|
|
12
12
|
export declare const ERROR_CONTAINS_EMPTY_STRING = "The object contains empty or 0 values. First empty or 0 value encountered during encoding: ";
|
|
13
|
+
/**
|
|
14
|
+
* rawEncode encodes objects using msgpack, regardless of whether there are
|
|
15
|
+
* empty or 0 value fields.
|
|
16
|
+
* @param obj - a dictionary to be encoded. May or may not contain empty or 0 values.
|
|
17
|
+
* @returns msgpack representation of the object
|
|
18
|
+
*/
|
|
19
|
+
export declare function rawEncode(obj: Record<string | number | symbol, any>): Uint8Array;
|
|
13
20
|
/**
|
|
14
21
|
* encode encodes objects using msgpack
|
|
15
22
|
* @param obj - a dictionary to be encoded. Must not contain empty or 0 values.
|
package/dist/types/logicsig.d.ts
CHANGED
|
@@ -173,6 +173,14 @@ export declare function logicSigFromByte(encoded: Uint8Array): LogicSig;
|
|
|
173
173
|
* @param programHash - string representation of teal program hash (= contract address for LogicSigs)
|
|
174
174
|
*/
|
|
175
175
|
export declare function tealSign(sk: Uint8Array, data: Uint8Array | Buffer, programHash: string): Uint8Array;
|
|
176
|
+
/**
|
|
177
|
+
* verifyTealSign verifies a signature as would the ed25519verify opcode
|
|
178
|
+
* @param data - buffer with original signed data
|
|
179
|
+
* @param programHash - string representation of teal program hash (= contract address for LogicSigs)
|
|
180
|
+
* @param sig - uint8array with the signature to verify (produced by tealSign/tealSignFromProgram)
|
|
181
|
+
* @param pk - uint8array with public key to verify against
|
|
182
|
+
*/
|
|
183
|
+
export declare function verifyTealSign(data: Uint8Array | Buffer, programHash: string, sig: Uint8Array, pk: Uint8Array): boolean;
|
|
176
184
|
/**
|
|
177
185
|
* tealSignFromProgram creates a signature compatible with ed25519verify opcode from raw program bytes
|
|
178
186
|
* @param sk - uint8array with secret key
|
package/dist/types/main.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export * as indexerModels from './client/v2/indexer/models/types';
|
|
|
76
76
|
export { mnemonicToMasterDerivationKey, masterDerivationKeyToMnemonic, secretKeyToMnemonic, mnemonicToSecretKey, seedFromMnemonic, mnemonicFromSeed, } from './mnemonic/mnemonic';
|
|
77
77
|
export { microalgosToAlgos, algosToMicroalgos, INVALID_MICROALGOS_ERROR_MSG, } from './convert';
|
|
78
78
|
export { computeGroupID, assignGroupID } from './group';
|
|
79
|
-
export { LogicSig, LogicSigAccount, signLogicSigTransaction, signLogicSigTransactionObject, logicSigFromByte, tealSign, tealSignFromProgram, } from './logicsig';
|
|
79
|
+
export { LogicSig, LogicSigAccount, signLogicSigTransaction, signLogicSigTransactionObject, logicSigFromByte, tealSign, tealSignFromProgram, verifyTealSign, } from './logicsig';
|
|
80
80
|
export { signMultisigTransaction, mergeMultisigTransactions, appendSignMultisigTransaction, createMultisigTransaction, appendSignRawMultisigSignature, verifyMultisig, multisigAddress, } from './multisig';
|
|
81
81
|
export { SourceMap } from './logic/sourcemap';
|
|
82
82
|
export * from './dryrun';
|
package/dist/types/signer.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export declare function makeLogicSigAccountTransactionSigner(account: LogicSigAc
|
|
|
25
25
|
* @param sks - An array of private keys belonging to the msig which should sign the transactions.
|
|
26
26
|
*/
|
|
27
27
|
export declare function makeMultiSigAccountTransactionSigner(msig: MultisigMetadata, sks: Uint8Array[]): TransactionSigner;
|
|
28
|
+
/**
|
|
29
|
+
* Create a makeEmptyTransactionSigner that does not specify any signer or
|
|
30
|
+
* signing capabilities. This should only be used to simulate transactions.
|
|
31
|
+
*/
|
|
32
|
+
export declare function makeEmptyTransactionSigner(): TransactionSigner;
|
|
28
33
|
/** Represents an unsigned transactions and a signer that can authorize that transaction. */
|
|
29
34
|
export interface TransactionWithSigner {
|
|
30
35
|
/** An unsigned transaction */
|
|
@@ -140,6 +140,15 @@ export declare class Transaction implements TransactionStorageStructure {
|
|
|
140
140
|
prettyPrint(): void;
|
|
141
141
|
toString(): string;
|
|
142
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* encodeUnsignedSimulateTransaction takes a txnBuilder.Transaction object,
|
|
145
|
+
* converts it into a SignedTransaction-like object, and converts it to a Buffer.
|
|
146
|
+
*
|
|
147
|
+
* Note: this function should only be used to simulate unsigned transactions.
|
|
148
|
+
*
|
|
149
|
+
* @param transactionObject - Transaction object to simulate.
|
|
150
|
+
*/
|
|
151
|
+
export declare function encodeUnsignedSimulateTransaction(transactionObject: Transaction): Uint8Array;
|
|
143
152
|
/**
|
|
144
153
|
* encodeUnsignedTransaction takes a completed txnBuilder.Transaction object, such as from the makeFoo
|
|
145
154
|
* family of transactions, and converts it to a Buffer
|
|
@@ -21,7 +21,7 @@ export declare type TransactionBase = TransactionBaseWithoutSuggestedParams | Tr
|
|
|
21
21
|
* - A: Additional parameters on top of the base transaction parameters
|
|
22
22
|
* - O: A set of overwrites for transaction parameters
|
|
23
23
|
*/
|
|
24
|
-
export declare type ConstructTransaction<A = {}, O = {}> = DistributiveOverwrite<TransactionBase & A, O>;
|
|
24
|
+
export declare type ConstructTransaction<A = {}, O extends Partial<TransactionBase & A> = {}> = DistributiveOverwrite<TransactionBase & A, O>;
|
|
25
25
|
/**
|
|
26
26
|
* Only accept transaction objects that include suggestedParams as an object
|
|
27
27
|
*/
|
|
@@ -16,7 +16,7 @@ export declare type Overwrite<T, U extends Partial<T>> = Pick<T, Exclude<keyof T
|
|
|
16
16
|
/**
|
|
17
17
|
* Same as Overwrite, but will distribute the Overwrite over unions
|
|
18
18
|
*/
|
|
19
|
-
export declare type DistributiveOverwrite<T, K
|
|
19
|
+
export declare type DistributiveOverwrite<T, K extends Partial<T>> = T extends unknown ? Overwrite<T, K> : never;
|
|
20
20
|
/**
|
|
21
21
|
* Mark certain keys as prohibited
|
|
22
22
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "algosdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "The official JavaScript SDK for Algorand",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"algo-msgpack-with-bigint": "^2.1.1",
|
|
25
|
-
"buffer": "^6.0.
|
|
25
|
+
"buffer": "^6.0.3",
|
|
26
26
|
"cross-fetch": "^3.1.5",
|
|
27
27
|
"hi-base32": "^0.5.1",
|
|
28
28
|
"js-sha256": "^0.9.0",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/json-bigint": "^1.0.0",
|
|
37
37
|
"@types/mocha": "^8.2.2",
|
|
38
|
-
"@types/url-parse": "^1.4.3",
|
|
39
38
|
"@typescript-eslint/eslint-plugin": "^4.26.1",
|
|
40
39
|
"@typescript-eslint/parser": "^4.26.1",
|
|
41
40
|
"assert": "^2.0.0",
|
package/src/abi/abi_type.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
// | string
|
|
14
14
|
// | (T1, ..., Tn)
|
|
15
15
|
*/
|
|
16
|
+
import { Buffer } from 'buffer';
|
|
16
17
|
import { encodeAddress, decodeAddress } from '../encoding/address';
|
|
17
18
|
import { bigIntToBytes, bytesToBigInt } from '../encoding/bigint';
|
|
18
19
|
import { concatArrays } from '../utils/utils';
|
package/src/bid.ts
CHANGED
package/src/client/client.ts
CHANGED
package/src/client/kmd.ts
CHANGED
|
@@ -30,6 +30,8 @@ import {
|
|
|
30
30
|
} from '../../urlTokenBaseHTTPClient';
|
|
31
31
|
import LightBlockHeaderProof from './lightBlockHeaderProof';
|
|
32
32
|
import StateProof from './stateproof';
|
|
33
|
+
import Disassemble from './disassemble';
|
|
34
|
+
import SimulateRawTransactions from './simulateTransaction';
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* Algod client connects an application to the Algorand blockchain. The algod client requires a valid algod REST endpoint IP address and algod token from an Algorand node that is connected to the network you plan to interact with.
|
|
@@ -397,6 +399,22 @@ export default class AlgodClient extends ServiceClient {
|
|
|
397
399
|
return new Compile(this.c, source);
|
|
398
400
|
}
|
|
399
401
|
|
|
402
|
+
/**
|
|
403
|
+
* Given the program bytes, return the TEAL source code in plain text.
|
|
404
|
+
*
|
|
405
|
+
* #### Example
|
|
406
|
+
* ```typescript
|
|
407
|
+
* const bytecode = "TEAL bytecode";
|
|
408
|
+
* const disassembledSource = await algodClient.disassemble(bytecode).do();
|
|
409
|
+
* ```
|
|
410
|
+
*
|
|
411
|
+
* @remarks This endpoint is only enabled when a node's configuration file sets EnableDeveloperAPI to true.
|
|
412
|
+
* @param source
|
|
413
|
+
*/
|
|
414
|
+
disassemble(source: string | Uint8Array) {
|
|
415
|
+
return new Disassemble(this.c, source);
|
|
416
|
+
}
|
|
417
|
+
|
|
400
418
|
/**
|
|
401
419
|
* Provides debugging information for a transaction (or group).
|
|
402
420
|
*
|
|
@@ -558,4 +576,20 @@ export default class AlgodClient extends ServiceClient {
|
|
|
558
576
|
getStateProof(round: number) {
|
|
559
577
|
return new StateProof(this.c, this.intDecoding, round);
|
|
560
578
|
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Simulate a list of a signed transaction objects being sent to the network.
|
|
582
|
+
*
|
|
583
|
+
* #### Example
|
|
584
|
+
* ```typescript
|
|
585
|
+
* const resp = await client.simulateRawTransactions([signedTxn1, signedTxn2]).do();
|
|
586
|
+
* ```
|
|
587
|
+
*
|
|
588
|
+
* [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/v2/#post-v2transactionssimulate)
|
|
589
|
+
* @param stxOrStxs
|
|
590
|
+
* @category POST
|
|
591
|
+
*/
|
|
592
|
+
simulateRawTransactions(stxOrStxs: Uint8Array | Uint8Array[]) {
|
|
593
|
+
return new SimulateRawTransactions(this.c, stxOrStxs);
|
|
594
|
+
}
|
|
561
595
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Buffer } from 'buffer';
|
|
2
|
+
import JSONRequest from '../jsonrequest';
|
|
3
|
+
import HTTPClient from '../../client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sets the default header (if not previously set)
|
|
7
|
+
* @param headers - A headers object
|
|
8
|
+
*/
|
|
9
|
+
export function setHeaders(headers = {}) {
|
|
10
|
+
let hdrs = headers;
|
|
11
|
+
if (Object.keys(hdrs).every((key) => key.toLowerCase() !== 'content-type')) {
|
|
12
|
+
hdrs = { ...headers };
|
|
13
|
+
hdrs['Content-Type'] = 'text/plain';
|
|
14
|
+
}
|
|
15
|
+
return hdrs;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Executes disassemble
|
|
20
|
+
*/
|
|
21
|
+
export default class Disassemble extends JSONRequest {
|
|
22
|
+
constructor(c: HTTPClient, private source: string | Uint8Array) {
|
|
23
|
+
super(c);
|
|
24
|
+
this.source = source;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line class-methods-use-this
|
|
28
|
+
path() {
|
|
29
|
+
return `/v2/teal/disassemble`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Executes disassemble
|
|
34
|
+
* @param headers - A headers object
|
|
35
|
+
*/
|
|
36
|
+
async do(headers = {}) {
|
|
37
|
+
const txHeaders = setHeaders(headers);
|
|
38
|
+
const res = await this.c.post(
|
|
39
|
+
this.path(),
|
|
40
|
+
Buffer.from(this.source),
|
|
41
|
+
txHeaders,
|
|
42
|
+
this.query
|
|
43
|
+
);
|
|
44
|
+
return res.body;
|
|
45
|
+
}
|
|
46
|
+
}
|