algosdk 2.1.0 → 2.3.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 +5 -7
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/client/v2/algod/algod.js +215 -23
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxByName.js +1 -1
- package/dist/cjs/client/v2/algod/getApplicationBoxes.js +1 -1
- package/dist/cjs/client/v2/algod/getBlockOffsetTimestamp.js +19 -0
- package/dist/cjs/client/v2/algod/getBlockOffsetTimestamp.js.map +1 -0
- package/dist/cjs/client/v2/algod/getSyncRound.js +19 -0
- package/dist/cjs/client/v2/algod/getSyncRound.js.map +1 -0
- package/dist/cjs/client/v2/algod/models/types.js +361 -8
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/algod/ready.js +14 -0
- package/dist/cjs/client/v2/algod/ready.js.map +1 -0
- package/dist/cjs/client/v2/algod/setBlockOffsetTimestamp.js +22 -0
- package/dist/cjs/client/v2/algod/setBlockOffsetTimestamp.js.map +1 -0
- package/dist/cjs/client/v2/algod/setSyncRound.js +22 -0
- package/dist/cjs/client/v2/algod/setSyncRound.js.map +1 -0
- package/dist/cjs/client/v2/algod/simulateTransaction.js +73 -0
- package/dist/cjs/client/v2/algod/simulateTransaction.js.map +1 -0
- package/dist/cjs/client/v2/algod/suggestedParams.js +1 -0
- package/dist/cjs/client/v2/algod/suggestedParams.js.map +1 -1
- package/dist/cjs/client/v2/algod/unsetSyncRound.js +18 -0
- package/dist/cjs/client/v2/algod/unsetSyncRound.js.map +1 -0
- package/dist/cjs/composer.js +106 -18
- package/dist/cjs/composer.js.map +1 -1
- package/dist/cjs/encoding/encoding.js +14 -3
- package/dist/cjs/encoding/encoding.js.map +1 -1
- package/dist/cjs/main.js.map +1 -1
- package/dist/cjs/makeTxn.js.map +1 -1
- package/dist/cjs/signer.js +17 -1
- package/dist/cjs/signer.js.map +1 -1
- package/dist/cjs/transaction.js +16 -1
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/esm/client/v2/algod/algod.js +192 -23
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxByName.js +1 -1
- package/dist/esm/client/v2/algod/getApplicationBoxes.js +1 -1
- package/dist/esm/client/v2/algod/getBlockOffsetTimestamp.js +13 -0
- package/dist/esm/client/v2/algod/getBlockOffsetTimestamp.js.map +1 -0
- package/dist/esm/client/v2/algod/getSyncRound.js +13 -0
- package/dist/esm/client/v2/algod/getSyncRound.js.map +1 -0
- package/dist/esm/client/v2/algod/models/types.js +351 -7
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/algod/ready.js +8 -0
- package/dist/esm/client/v2/algod/ready.js.map +1 -0
- package/dist/esm/client/v2/algod/setBlockOffsetTimestamp.js +16 -0
- package/dist/esm/client/v2/algod/setBlockOffsetTimestamp.js.map +1 -0
- package/dist/esm/client/v2/algod/setSyncRound.js +16 -0
- package/dist/esm/client/v2/algod/setSyncRound.js.map +1 -0
- package/dist/esm/client/v2/algod/simulateTransaction.js +42 -0
- package/dist/esm/client/v2/algod/simulateTransaction.js.map +1 -0
- package/dist/esm/client/v2/algod/suggestedParams.js +1 -0
- package/dist/esm/client/v2/algod/suggestedParams.js.map +1 -1
- package/dist/esm/client/v2/algod/unsetSyncRound.js +12 -0
- package/dist/esm/client/v2/algod/unsetSyncRound.js.map +1 -0
- package/dist/esm/composer.js +84 -19
- package/dist/esm/composer.js.map +1 -1
- package/dist/esm/encoding/encoding.js +12 -2
- package/dist/esm/encoding/encoding.js.map +1 -1
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/makeTxn.js.map +1 -1
- package/dist/esm/signer.js +15 -0
- package/dist/esm/signer.js.map +1 -1
- package/dist/esm/transaction.js +14 -0
- package/dist/esm/transaction.js.map +1 -1
- package/dist/types/client/v2/algod/algod.d.ts +158 -23
- package/dist/types/client/v2/algod/getApplicationBoxByName.d.ts +1 -1
- package/dist/types/client/v2/algod/getApplicationBoxes.d.ts +1 -1
- package/dist/types/client/v2/algod/getBlockOffsetTimestamp.d.ts +6 -0
- package/dist/types/client/v2/algod/getSyncRound.d.ts +6 -0
- package/dist/types/client/v2/algod/models/types.d.ts +324 -14
- package/dist/types/client/v2/algod/ready.d.ts +4 -0
- package/dist/types/client/v2/algod/setBlockOffsetTimestamp.d.ts +9 -0
- package/dist/types/client/v2/algod/setSyncRound.d.ts +9 -0
- package/dist/types/client/v2/algod/simulateTransaction.d.ts +19 -0
- package/dist/types/client/v2/algod/suggestedParams.d.ts +3 -3
- package/dist/types/client/v2/algod/unsetSyncRound.d.ts +5 -0
- package/dist/types/composer.d.ts +31 -1
- package/dist/types/encoding/encoding.d.ts +7 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/makeTxn.d.ts +1 -3
- package/dist/types/signer.d.ts +5 -0
- package/dist/types/transaction.d.ts +9 -0
- package/dist/types/types/transactions/base.d.ts +6 -0
- package/dist/types/types/transactions/builder.d.ts +1 -1
- package/dist/types/types/utils.d.ts +1 -1
- package/package.json +2 -2
- package/src/client/v2/algod/algod.ts +199 -23
- package/src/client/v2/algod/getApplicationBoxByName.ts +1 -1
- package/src/client/v2/algod/getApplicationBoxes.ts +1 -1
- package/src/client/v2/algod/getBlockOffsetTimestamp.ts +17 -0
- package/src/client/v2/algod/getSyncRound.ts +17 -0
- package/src/client/v2/algod/models/types.ts +652 -12
- package/src/client/v2/algod/ready.ts +8 -0
- package/src/client/v2/algod/setBlockOffsetTimestamp.ts +20 -0
- package/src/client/v2/algod/setSyncRound.ts +20 -0
- package/src/client/v2/algod/simulateTransaction.ts +58 -0
- package/src/client/v2/algod/suggestedParams.ts +4 -3
- package/src/client/v2/algod/unsetSyncRound.ts +13 -0
- package/src/composer.ts +138 -31
- package/src/encoding/encoding.ts +13 -2
- package/src/main.ts +7 -0
- package/src/makeTxn.ts +2 -4
- package/src/signer.ts +18 -1
- package/src/transaction.ts +17 -0
- package/src/types/transactions/base.ts +7 -0
- package/src/types/transactions/builder.ts +4 -4
- package/src/types/utils.ts +1 -1
|
@@ -446,9 +446,9 @@ export class ApplicationParams extends BaseModel {
|
|
|
446
446
|
* @param creator - The address that created this application. This is the address where the
|
|
447
447
|
* parameters and global state for this application can be found.
|
|
448
448
|
* @param extraProgramPages - (epp) the amount of extra program pages available to this app.
|
|
449
|
-
* @param globalState -
|
|
450
|
-
* @param globalStateSchema -
|
|
451
|
-
* @param localStateSchema -
|
|
449
|
+
* @param globalState - (gs) global state
|
|
450
|
+
* @param globalStateSchema - (gsch) global schema
|
|
451
|
+
* @param localStateSchema - (lsch) local schema
|
|
452
452
|
*/
|
|
453
453
|
constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }) {
|
|
454
454
|
super();
|
|
@@ -1356,6 +1356,93 @@ export class EvalDeltaKeyValue extends BaseModel {
|
|
|
1356
1356
|
/* eslint-enable dot-notation */
|
|
1357
1357
|
}
|
|
1358
1358
|
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Response containing the timestamp offset in seconds
|
|
1361
|
+
*/
|
|
1362
|
+
export class GetBlockTimeStampOffsetResponse extends BaseModel {
|
|
1363
|
+
/**
|
|
1364
|
+
* Creates a new `GetBlockTimeStampOffsetResponse` object.
|
|
1365
|
+
* @param offset - Timestamp offset in seconds.
|
|
1366
|
+
*/
|
|
1367
|
+
constructor({ offset }) {
|
|
1368
|
+
super();
|
|
1369
|
+
this.offset = offset;
|
|
1370
|
+
this.attribute_map = {
|
|
1371
|
+
offset: 'offset',
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
// eslint-disable-next-line camelcase
|
|
1375
|
+
static from_obj_for_encoding(data) {
|
|
1376
|
+
/* eslint-disable dot-notation */
|
|
1377
|
+
if (typeof data['offset'] === 'undefined')
|
|
1378
|
+
throw new Error(`Response is missing required field 'offset': ${data}`);
|
|
1379
|
+
return new GetBlockTimeStampOffsetResponse({
|
|
1380
|
+
offset: data['offset'],
|
|
1381
|
+
});
|
|
1382
|
+
/* eslint-enable dot-notation */
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Response containing the ledger's minimum sync round
|
|
1387
|
+
*/
|
|
1388
|
+
export class GetSyncRoundResponse extends BaseModel {
|
|
1389
|
+
/**
|
|
1390
|
+
* Creates a new `GetSyncRoundResponse` object.
|
|
1391
|
+
* @param round - The minimum sync round for the ledger.
|
|
1392
|
+
*/
|
|
1393
|
+
constructor({ round }) {
|
|
1394
|
+
super();
|
|
1395
|
+
this.round = round;
|
|
1396
|
+
this.attribute_map = {
|
|
1397
|
+
round: 'round',
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
// eslint-disable-next-line camelcase
|
|
1401
|
+
static from_obj_for_encoding(data) {
|
|
1402
|
+
/* eslint-disable dot-notation */
|
|
1403
|
+
if (typeof data['round'] === 'undefined')
|
|
1404
|
+
throw new Error(`Response is missing required field 'round': ${data}`);
|
|
1405
|
+
return new GetSyncRoundResponse({
|
|
1406
|
+
round: data['round'],
|
|
1407
|
+
});
|
|
1408
|
+
/* eslint-enable dot-notation */
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* A single Delta containing the key, the previous value and the current value for
|
|
1413
|
+
* a single round.
|
|
1414
|
+
*/
|
|
1415
|
+
export class KvDelta extends BaseModel {
|
|
1416
|
+
/**
|
|
1417
|
+
* Creates a new `KvDelta` object.
|
|
1418
|
+
* @param key - The key, base64 encoded.
|
|
1419
|
+
* @param value - The new value of the KV store entry, base64 encoded.
|
|
1420
|
+
*/
|
|
1421
|
+
constructor({ key, value, }) {
|
|
1422
|
+
super();
|
|
1423
|
+
this.key =
|
|
1424
|
+
typeof key === 'string'
|
|
1425
|
+
? new Uint8Array(Buffer.from(key, 'base64'))
|
|
1426
|
+
: key;
|
|
1427
|
+
this.value =
|
|
1428
|
+
typeof value === 'string'
|
|
1429
|
+
? new Uint8Array(Buffer.from(value, 'base64'))
|
|
1430
|
+
: value;
|
|
1431
|
+
this.attribute_map = {
|
|
1432
|
+
key: 'key',
|
|
1433
|
+
value: 'value',
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
// eslint-disable-next-line camelcase
|
|
1437
|
+
static from_obj_for_encoding(data) {
|
|
1438
|
+
/* eslint-disable dot-notation */
|
|
1439
|
+
return new KvDelta({
|
|
1440
|
+
key: data['key'],
|
|
1441
|
+
value: data['value'],
|
|
1442
|
+
});
|
|
1443
|
+
/* eslint-enable dot-notation */
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1359
1446
|
/**
|
|
1360
1447
|
* Proof of membership and position of a light block header.
|
|
1361
1448
|
*/
|
|
@@ -1430,8 +1517,16 @@ export class NodeStatusResponse extends BaseModel {
|
|
|
1430
1517
|
* @param catchpointVerifiedKvs - The number of key-values (KVs) from the current catchpoint that have been
|
|
1431
1518
|
* verified so far as part of the catchup
|
|
1432
1519
|
* @param lastCatchpoint - The last catchpoint seen by the node
|
|
1520
|
+
* @param upgradeDelay - Upgrade delay
|
|
1521
|
+
* @param upgradeNextProtocolVoteBefore - Next protocol round
|
|
1522
|
+
* @param upgradeNoVotes - No votes cast for consensus upgrade
|
|
1523
|
+
* @param upgradeNodeVote - This node's upgrade vote
|
|
1524
|
+
* @param upgradeVoteRounds - Total voting rounds for current upgrade
|
|
1525
|
+
* @param upgradeVotes - Total votes cast for consensus upgrade
|
|
1526
|
+
* @param upgradeVotesRequired - Yes votes required for consensus upgrade
|
|
1527
|
+
* @param upgradeYesVotes - Yes votes cast for consensus upgrade
|
|
1433
1528
|
*/
|
|
1434
|
-
constructor({ catchupTime, lastRound, lastVersion, nextVersion, nextVersionRound, nextVersionSupported, stoppedAtUnsupportedRound, timeSinceLastRound, catchpoint, catchpointAcquiredBlocks, catchpointProcessedAccounts, catchpointProcessedKvs, catchpointTotalAccounts, catchpointTotalBlocks, catchpointTotalKvs, catchpointVerifiedAccounts, catchpointVerifiedKvs, lastCatchpoint, }) {
|
|
1529
|
+
constructor({ catchupTime, lastRound, lastVersion, nextVersion, nextVersionRound, nextVersionSupported, stoppedAtUnsupportedRound, timeSinceLastRound, catchpoint, catchpointAcquiredBlocks, catchpointProcessedAccounts, catchpointProcessedKvs, catchpointTotalAccounts, catchpointTotalBlocks, catchpointTotalKvs, catchpointVerifiedAccounts, catchpointVerifiedKvs, lastCatchpoint, upgradeDelay, upgradeNextProtocolVoteBefore, upgradeNoVotes, upgradeNodeVote, upgradeVoteRounds, upgradeVotes, upgradeVotesRequired, upgradeYesVotes, }) {
|
|
1435
1530
|
super();
|
|
1436
1531
|
this.catchupTime = catchupTime;
|
|
1437
1532
|
this.lastRound = lastRound;
|
|
@@ -1451,6 +1546,14 @@ export class NodeStatusResponse extends BaseModel {
|
|
|
1451
1546
|
this.catchpointVerifiedAccounts = catchpointVerifiedAccounts;
|
|
1452
1547
|
this.catchpointVerifiedKvs = catchpointVerifiedKvs;
|
|
1453
1548
|
this.lastCatchpoint = lastCatchpoint;
|
|
1549
|
+
this.upgradeDelay = upgradeDelay;
|
|
1550
|
+
this.upgradeNextProtocolVoteBefore = upgradeNextProtocolVoteBefore;
|
|
1551
|
+
this.upgradeNoVotes = upgradeNoVotes;
|
|
1552
|
+
this.upgradeNodeVote = upgradeNodeVote;
|
|
1553
|
+
this.upgradeVoteRounds = upgradeVoteRounds;
|
|
1554
|
+
this.upgradeVotes = upgradeVotes;
|
|
1555
|
+
this.upgradeVotesRequired = upgradeVotesRequired;
|
|
1556
|
+
this.upgradeYesVotes = upgradeYesVotes;
|
|
1454
1557
|
this.attribute_map = {
|
|
1455
1558
|
catchupTime: 'catchup-time',
|
|
1456
1559
|
lastRound: 'last-round',
|
|
@@ -1470,6 +1573,14 @@ export class NodeStatusResponse extends BaseModel {
|
|
|
1470
1573
|
catchpointVerifiedAccounts: 'catchpoint-verified-accounts',
|
|
1471
1574
|
catchpointVerifiedKvs: 'catchpoint-verified-kvs',
|
|
1472
1575
|
lastCatchpoint: 'last-catchpoint',
|
|
1576
|
+
upgradeDelay: 'upgrade-delay',
|
|
1577
|
+
upgradeNextProtocolVoteBefore: 'upgrade-next-protocol-vote-before',
|
|
1578
|
+
upgradeNoVotes: 'upgrade-no-votes',
|
|
1579
|
+
upgradeNodeVote: 'upgrade-node-vote',
|
|
1580
|
+
upgradeVoteRounds: 'upgrade-vote-rounds',
|
|
1581
|
+
upgradeVotes: 'upgrade-votes',
|
|
1582
|
+
upgradeVotesRequired: 'upgrade-votes-required',
|
|
1583
|
+
upgradeYesVotes: 'upgrade-yes-votes',
|
|
1473
1584
|
};
|
|
1474
1585
|
}
|
|
1475
1586
|
// eslint-disable-next-line camelcase
|
|
@@ -1510,6 +1621,14 @@ export class NodeStatusResponse extends BaseModel {
|
|
|
1510
1621
|
catchpointVerifiedAccounts: data['catchpoint-verified-accounts'],
|
|
1511
1622
|
catchpointVerifiedKvs: data['catchpoint-verified-kvs'],
|
|
1512
1623
|
lastCatchpoint: data['last-catchpoint'],
|
|
1624
|
+
upgradeDelay: data['upgrade-delay'],
|
|
1625
|
+
upgradeNextProtocolVoteBefore: data['upgrade-next-protocol-vote-before'],
|
|
1626
|
+
upgradeNoVotes: data['upgrade-no-votes'],
|
|
1627
|
+
upgradeNodeVote: data['upgrade-node-vote'],
|
|
1628
|
+
upgradeVoteRounds: data['upgrade-vote-rounds'],
|
|
1629
|
+
upgradeVotes: data['upgrade-votes'],
|
|
1630
|
+
upgradeVotesRequired: data['upgrade-votes-required'],
|
|
1631
|
+
upgradeYesVotes: data['upgrade-yes-votes'],
|
|
1513
1632
|
});
|
|
1514
1633
|
/* eslint-enable dot-notation */
|
|
1515
1634
|
}
|
|
@@ -1532,12 +1651,12 @@ export class PendingTransactionResponse extends BaseModel {
|
|
|
1532
1651
|
* @param closeRewards - Rewards in microalgos applied to the close remainder to account.
|
|
1533
1652
|
* @param closingAmount - Closing amount for the transaction.
|
|
1534
1653
|
* @param confirmedRound - The round where this transaction was confirmed, if present.
|
|
1535
|
-
* @param globalStateDelta -
|
|
1654
|
+
* @param globalStateDelta - Global state key/value changes for the application being executed by this
|
|
1536
1655
|
* transaction.
|
|
1537
1656
|
* @param innerTxns - Inner transactions produced by application execution.
|
|
1538
|
-
* @param localStateDelta -
|
|
1657
|
+
* @param localStateDelta - Local state key/value changes for the application being executed by this
|
|
1539
1658
|
* transaction.
|
|
1540
|
-
* @param logs -
|
|
1659
|
+
* @param logs - Logs for the application being executed by this transaction.
|
|
1541
1660
|
* @param receiverRewards - Rewards in microalgos applied to the receiver account.
|
|
1542
1661
|
* @param senderRewards - Rewards in microalgos applied to the sender account.
|
|
1543
1662
|
*/
|
|
@@ -1666,6 +1785,231 @@ export class PostTransactionsResponse extends BaseModel {
|
|
|
1666
1785
|
/* eslint-enable dot-notation */
|
|
1667
1786
|
}
|
|
1668
1787
|
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Request type for simulation endpoint.
|
|
1790
|
+
*/
|
|
1791
|
+
export class SimulateRequest extends BaseModel {
|
|
1792
|
+
/**
|
|
1793
|
+
* Creates a new `SimulateRequest` object.
|
|
1794
|
+
* @param txnGroups - The transaction groups to simulate.
|
|
1795
|
+
* @param allowEmptySignatures - Allow transactions without signatures to be simulated as if they had correct
|
|
1796
|
+
* signatures.
|
|
1797
|
+
* @param allowMoreLogging - Lifts limits on log opcode usage during simulation.
|
|
1798
|
+
*/
|
|
1799
|
+
constructor({ txnGroups, allowEmptySignatures, allowMoreLogging, }) {
|
|
1800
|
+
super();
|
|
1801
|
+
this.txnGroups = txnGroups;
|
|
1802
|
+
this.allowEmptySignatures = allowEmptySignatures;
|
|
1803
|
+
this.allowMoreLogging = allowMoreLogging;
|
|
1804
|
+
this.attribute_map = {
|
|
1805
|
+
txnGroups: 'txn-groups',
|
|
1806
|
+
allowEmptySignatures: 'allow-empty-signatures',
|
|
1807
|
+
allowMoreLogging: 'allow-more-logging',
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
// eslint-disable-next-line camelcase
|
|
1811
|
+
static from_obj_for_encoding(data) {
|
|
1812
|
+
/* eslint-disable dot-notation */
|
|
1813
|
+
if (!Array.isArray(data['txn-groups']))
|
|
1814
|
+
throw new Error(`Response is missing required array field 'txn-groups': ${data}`);
|
|
1815
|
+
return new SimulateRequest({
|
|
1816
|
+
txnGroups: data['txn-groups'].map(SimulateRequestTransactionGroup.from_obj_for_encoding),
|
|
1817
|
+
allowEmptySignatures: data['allow-empty-signatures'],
|
|
1818
|
+
allowMoreLogging: data['allow-more-logging'],
|
|
1819
|
+
});
|
|
1820
|
+
/* eslint-enable dot-notation */
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* A transaction group to simulate.
|
|
1825
|
+
*/
|
|
1826
|
+
export class SimulateRequestTransactionGroup extends BaseModel {
|
|
1827
|
+
/**
|
|
1828
|
+
* Creates a new `SimulateRequestTransactionGroup` object.
|
|
1829
|
+
* @param txns - An atomic transaction group.
|
|
1830
|
+
*/
|
|
1831
|
+
constructor({ txns }) {
|
|
1832
|
+
super();
|
|
1833
|
+
this.txns = txns;
|
|
1834
|
+
this.attribute_map = {
|
|
1835
|
+
txns: 'txns',
|
|
1836
|
+
};
|
|
1837
|
+
}
|
|
1838
|
+
// eslint-disable-next-line camelcase
|
|
1839
|
+
static from_obj_for_encoding(data) {
|
|
1840
|
+
/* eslint-disable dot-notation */
|
|
1841
|
+
if (!Array.isArray(data['txns']))
|
|
1842
|
+
throw new Error(`Response is missing required array field 'txns': ${data}`);
|
|
1843
|
+
return new SimulateRequestTransactionGroup({
|
|
1844
|
+
txns: data['txns'],
|
|
1845
|
+
});
|
|
1846
|
+
/* eslint-enable dot-notation */
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Result of a transaction group simulation.
|
|
1851
|
+
*/
|
|
1852
|
+
export class SimulateResponse extends BaseModel {
|
|
1853
|
+
/**
|
|
1854
|
+
* Creates a new `SimulateResponse` object.
|
|
1855
|
+
* @param lastRound - The round immediately preceding this simulation. State changes through this
|
|
1856
|
+
* round were used to run this simulation.
|
|
1857
|
+
* @param txnGroups - A result object for each transaction group that was simulated.
|
|
1858
|
+
* @param version - The version of this response object.
|
|
1859
|
+
* @param evalOverrides - The set of parameters and limits override during simulation. If this set of
|
|
1860
|
+
* parameters is present, then evaluation parameters may differ from standard
|
|
1861
|
+
* evaluation in certain ways.
|
|
1862
|
+
*/
|
|
1863
|
+
constructor({ lastRound, txnGroups, version, evalOverrides, }) {
|
|
1864
|
+
super();
|
|
1865
|
+
this.lastRound = lastRound;
|
|
1866
|
+
this.txnGroups = txnGroups;
|
|
1867
|
+
this.version = version;
|
|
1868
|
+
this.evalOverrides = evalOverrides;
|
|
1869
|
+
this.attribute_map = {
|
|
1870
|
+
lastRound: 'last-round',
|
|
1871
|
+
txnGroups: 'txn-groups',
|
|
1872
|
+
version: 'version',
|
|
1873
|
+
evalOverrides: 'eval-overrides',
|
|
1874
|
+
};
|
|
1875
|
+
}
|
|
1876
|
+
// eslint-disable-next-line camelcase
|
|
1877
|
+
static from_obj_for_encoding(data) {
|
|
1878
|
+
/* eslint-disable dot-notation */
|
|
1879
|
+
if (typeof data['last-round'] === 'undefined')
|
|
1880
|
+
throw new Error(`Response is missing required field 'last-round': ${data}`);
|
|
1881
|
+
if (!Array.isArray(data['txn-groups']))
|
|
1882
|
+
throw new Error(`Response is missing required array field 'txn-groups': ${data}`);
|
|
1883
|
+
if (typeof data['version'] === 'undefined')
|
|
1884
|
+
throw new Error(`Response is missing required field 'version': ${data}`);
|
|
1885
|
+
return new SimulateResponse({
|
|
1886
|
+
lastRound: data['last-round'],
|
|
1887
|
+
txnGroups: data['txn-groups'].map(SimulateTransactionGroupResult.from_obj_for_encoding),
|
|
1888
|
+
version: data['version'],
|
|
1889
|
+
evalOverrides: typeof data['eval-overrides'] !== 'undefined'
|
|
1890
|
+
? SimulationEvalOverrides.from_obj_for_encoding(data['eval-overrides'])
|
|
1891
|
+
: undefined,
|
|
1892
|
+
});
|
|
1893
|
+
/* eslint-enable dot-notation */
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Simulation result for an atomic transaction group
|
|
1898
|
+
*/
|
|
1899
|
+
export class SimulateTransactionGroupResult extends BaseModel {
|
|
1900
|
+
/**
|
|
1901
|
+
* Creates a new `SimulateTransactionGroupResult` object.
|
|
1902
|
+
* @param txnResults - Simulation result for individual transactions
|
|
1903
|
+
* @param appBudgetAdded - Total budget added during execution of app calls in the transaction group.
|
|
1904
|
+
* @param appBudgetConsumed - Total budget consumed during execution of app calls in the transaction group.
|
|
1905
|
+
* @param failedAt - If present, indicates which transaction in this group caused the failure. This
|
|
1906
|
+
* array represents the path to the failing transaction. Indexes are zero based,
|
|
1907
|
+
* the first element indicates the top-level transaction, and successive elements
|
|
1908
|
+
* indicate deeper inner transactions.
|
|
1909
|
+
* @param failureMessage - If present, indicates that the transaction group failed and specifies why that
|
|
1910
|
+
* happened
|
|
1911
|
+
*/
|
|
1912
|
+
constructor({ txnResults, appBudgetAdded, appBudgetConsumed, failedAt, failureMessage, }) {
|
|
1913
|
+
super();
|
|
1914
|
+
this.txnResults = txnResults;
|
|
1915
|
+
this.appBudgetAdded = appBudgetAdded;
|
|
1916
|
+
this.appBudgetConsumed = appBudgetConsumed;
|
|
1917
|
+
this.failedAt = failedAt;
|
|
1918
|
+
this.failureMessage = failureMessage;
|
|
1919
|
+
this.attribute_map = {
|
|
1920
|
+
txnResults: 'txn-results',
|
|
1921
|
+
appBudgetAdded: 'app-budget-added',
|
|
1922
|
+
appBudgetConsumed: 'app-budget-consumed',
|
|
1923
|
+
failedAt: 'failed-at',
|
|
1924
|
+
failureMessage: 'failure-message',
|
|
1925
|
+
};
|
|
1926
|
+
}
|
|
1927
|
+
// eslint-disable-next-line camelcase
|
|
1928
|
+
static from_obj_for_encoding(data) {
|
|
1929
|
+
/* eslint-disable dot-notation */
|
|
1930
|
+
if (!Array.isArray(data['txn-results']))
|
|
1931
|
+
throw new Error(`Response is missing required array field 'txn-results': ${data}`);
|
|
1932
|
+
return new SimulateTransactionGroupResult({
|
|
1933
|
+
txnResults: data['txn-results'].map(SimulateTransactionResult.from_obj_for_encoding),
|
|
1934
|
+
appBudgetAdded: data['app-budget-added'],
|
|
1935
|
+
appBudgetConsumed: data['app-budget-consumed'],
|
|
1936
|
+
failedAt: data['failed-at'],
|
|
1937
|
+
failureMessage: data['failure-message'],
|
|
1938
|
+
});
|
|
1939
|
+
/* eslint-enable dot-notation */
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Simulation result for an individual transaction
|
|
1944
|
+
*/
|
|
1945
|
+
export class SimulateTransactionResult extends BaseModel {
|
|
1946
|
+
/**
|
|
1947
|
+
* Creates a new `SimulateTransactionResult` object.
|
|
1948
|
+
* @param txnResult - Details about a pending transaction. If the transaction was recently confirmed,
|
|
1949
|
+
* includes confirmation details like the round and reward details.
|
|
1950
|
+
* @param appBudgetConsumed - Budget used during execution of an app call transaction. This value includes
|
|
1951
|
+
* budged used by inner app calls spawned by this transaction.
|
|
1952
|
+
* @param logicSigBudgetConsumed - Budget used during execution of a logic sig transaction.
|
|
1953
|
+
*/
|
|
1954
|
+
constructor({ txnResult, appBudgetConsumed, logicSigBudgetConsumed, }) {
|
|
1955
|
+
super();
|
|
1956
|
+
this.txnResult = txnResult;
|
|
1957
|
+
this.appBudgetConsumed = appBudgetConsumed;
|
|
1958
|
+
this.logicSigBudgetConsumed = logicSigBudgetConsumed;
|
|
1959
|
+
this.attribute_map = {
|
|
1960
|
+
txnResult: 'txn-result',
|
|
1961
|
+
appBudgetConsumed: 'app-budget-consumed',
|
|
1962
|
+
logicSigBudgetConsumed: 'logic-sig-budget-consumed',
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1965
|
+
// eslint-disable-next-line camelcase
|
|
1966
|
+
static from_obj_for_encoding(data) {
|
|
1967
|
+
/* eslint-disable dot-notation */
|
|
1968
|
+
if (typeof data['txn-result'] === 'undefined')
|
|
1969
|
+
throw new Error(`Response is missing required field 'txn-result': ${data}`);
|
|
1970
|
+
return new SimulateTransactionResult({
|
|
1971
|
+
txnResult: PendingTransactionResponse.from_obj_for_encoding(data['txn-result']),
|
|
1972
|
+
appBudgetConsumed: data['app-budget-consumed'],
|
|
1973
|
+
logicSigBudgetConsumed: data['logic-sig-budget-consumed'],
|
|
1974
|
+
});
|
|
1975
|
+
/* eslint-enable dot-notation */
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
/**
|
|
1979
|
+
* The set of parameters and limits override during simulation. If this set of
|
|
1980
|
+
* parameters is present, then evaluation parameters may differ from standard
|
|
1981
|
+
* evaluation in certain ways.
|
|
1982
|
+
*/
|
|
1983
|
+
export class SimulationEvalOverrides extends BaseModel {
|
|
1984
|
+
/**
|
|
1985
|
+
* Creates a new `SimulationEvalOverrides` object.
|
|
1986
|
+
* @param allowEmptySignatures - If true, transactions without signatures are allowed and simulated as if they
|
|
1987
|
+
* were properly signed.
|
|
1988
|
+
* @param maxLogCalls - The maximum log calls one can make during simulation
|
|
1989
|
+
* @param maxLogSize - The maximum byte number to log during simulation
|
|
1990
|
+
*/
|
|
1991
|
+
constructor({ allowEmptySignatures, maxLogCalls, maxLogSize, }) {
|
|
1992
|
+
super();
|
|
1993
|
+
this.allowEmptySignatures = allowEmptySignatures;
|
|
1994
|
+
this.maxLogCalls = maxLogCalls;
|
|
1995
|
+
this.maxLogSize = maxLogSize;
|
|
1996
|
+
this.attribute_map = {
|
|
1997
|
+
allowEmptySignatures: 'allow-empty-signatures',
|
|
1998
|
+
maxLogCalls: 'max-log-calls',
|
|
1999
|
+
maxLogSize: 'max-log-size',
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
// eslint-disable-next-line camelcase
|
|
2003
|
+
static from_obj_for_encoding(data) {
|
|
2004
|
+
/* eslint-disable dot-notation */
|
|
2005
|
+
return new SimulationEvalOverrides({
|
|
2006
|
+
allowEmptySignatures: data['allow-empty-signatures'],
|
|
2007
|
+
maxLogCalls: data['max-log-calls'],
|
|
2008
|
+
maxLogSize: data['max-log-size'],
|
|
2009
|
+
});
|
|
2010
|
+
/* eslint-enable dot-notation */
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
1669
2013
|
/**
|
|
1670
2014
|
* Represents a state proof and its corresponding message
|
|
1671
2015
|
*/
|