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
|
@@ -6,7 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.Version = exports.TransactionProofResponse = exports.TransactionParametersResponse = exports.TealValue = exports.TealKeyValue = exports.SupplyResponse = exports.StateProofMessage = exports.StateProof = exports.PostTransactionsResponse = exports.PendingTransactionsResponse = exports.PendingTransactionResponse = exports.NodeStatusResponse = exports.LightBlockHeaderProof = exports.EvalDeltaKeyValue = exports.EvalDelta = exports.ErrorResponse = exports.DryrunTxnResult = exports.DryrunState = exports.DryrunSource = exports.DryrunResponse = exports.DryrunRequest = exports.DisassembleResponse = exports.CompileResponse = exports.BuildVersion = exports.BoxesResponse = exports.BoxDescriptor = exports.Box = exports.BlockResponse = exports.BlockHashResponse = exports.AssetParams = exports.AssetHolding = exports.Asset = exports.ApplicationStateSchema = exports.ApplicationParams = exports.ApplicationLocalState = exports.Application = exports.AccountStateDelta = exports.AccountParticipation = exports.AccountAssetResponse = exports.AccountApplicationResponse = exports.Account = void 0;
|
|
9
|
+
exports.Version = exports.TransactionProofResponse = exports.TransactionParametersResponse = exports.TealValue = exports.TealKeyValue = exports.SupplyResponse = exports.StateProofMessage = exports.StateProof = exports.SimulationEvalOverrides = exports.SimulateTransactionResult = exports.SimulateTransactionGroupResult = exports.SimulateResponse = exports.SimulateRequestTransactionGroup = exports.SimulateRequest = exports.PostTransactionsResponse = exports.PendingTransactionsResponse = exports.PendingTransactionResponse = exports.NodeStatusResponse = exports.LightBlockHeaderProof = exports.KvDelta = exports.GetSyncRoundResponse = exports.GetBlockTimeStampOffsetResponse = exports.EvalDeltaKeyValue = exports.EvalDelta = exports.ErrorResponse = exports.DryrunTxnResult = exports.DryrunState = exports.DryrunSource = exports.DryrunResponse = exports.DryrunRequest = exports.DisassembleResponse = exports.CompileResponse = exports.BuildVersion = exports.BoxesResponse = exports.BoxDescriptor = exports.Box = exports.BlockResponse = exports.BlockHashResponse = exports.AssetParams = exports.AssetHolding = exports.Asset = exports.ApplicationStateSchema = exports.ApplicationParams = exports.ApplicationLocalState = exports.Application = exports.AccountStateDelta = exports.AccountParticipation = exports.AccountAssetResponse = exports.AccountApplicationResponse = exports.Account = void 0;
|
|
10
10
|
/* eslint-disable no-use-before-define */
|
|
11
11
|
const buffer_1 = require("buffer");
|
|
12
12
|
const basemodel_1 = __importDefault(require("../../basemodel"));
|
|
@@ -459,9 +459,9 @@ class ApplicationParams extends basemodel_1.default {
|
|
|
459
459
|
* @param creator - The address that created this application. This is the address where the
|
|
460
460
|
* parameters and global state for this application can be found.
|
|
461
461
|
* @param extraProgramPages - (epp) the amount of extra program pages available to this app.
|
|
462
|
-
* @param globalState -
|
|
463
|
-
* @param globalStateSchema -
|
|
464
|
-
* @param localStateSchema -
|
|
462
|
+
* @param globalState - (gs) global state
|
|
463
|
+
* @param globalStateSchema - (gsch) global schema
|
|
464
|
+
* @param localStateSchema - (lsch) local schema
|
|
465
465
|
*/
|
|
466
466
|
constructor({ approvalProgram, clearStateProgram, creator, extraProgramPages, globalState, globalStateSchema, localStateSchema, }) {
|
|
467
467
|
super();
|
|
@@ -1390,6 +1390,96 @@ class EvalDeltaKeyValue extends basemodel_1.default {
|
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
1392
|
exports.EvalDeltaKeyValue = EvalDeltaKeyValue;
|
|
1393
|
+
/**
|
|
1394
|
+
* Response containing the timestamp offset in seconds
|
|
1395
|
+
*/
|
|
1396
|
+
class GetBlockTimeStampOffsetResponse extends basemodel_1.default {
|
|
1397
|
+
/**
|
|
1398
|
+
* Creates a new `GetBlockTimeStampOffsetResponse` object.
|
|
1399
|
+
* @param offset - Timestamp offset in seconds.
|
|
1400
|
+
*/
|
|
1401
|
+
constructor({ offset }) {
|
|
1402
|
+
super();
|
|
1403
|
+
this.offset = offset;
|
|
1404
|
+
this.attribute_map = {
|
|
1405
|
+
offset: 'offset',
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
// eslint-disable-next-line camelcase
|
|
1409
|
+
static from_obj_for_encoding(data) {
|
|
1410
|
+
/* eslint-disable dot-notation */
|
|
1411
|
+
if (typeof data['offset'] === 'undefined')
|
|
1412
|
+
throw new Error(`Response is missing required field 'offset': ${data}`);
|
|
1413
|
+
return new GetBlockTimeStampOffsetResponse({
|
|
1414
|
+
offset: data['offset'],
|
|
1415
|
+
});
|
|
1416
|
+
/* eslint-enable dot-notation */
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
exports.GetBlockTimeStampOffsetResponse = GetBlockTimeStampOffsetResponse;
|
|
1420
|
+
/**
|
|
1421
|
+
* Response containing the ledger's minimum sync round
|
|
1422
|
+
*/
|
|
1423
|
+
class GetSyncRoundResponse extends basemodel_1.default {
|
|
1424
|
+
/**
|
|
1425
|
+
* Creates a new `GetSyncRoundResponse` object.
|
|
1426
|
+
* @param round - The minimum sync round for the ledger.
|
|
1427
|
+
*/
|
|
1428
|
+
constructor({ round }) {
|
|
1429
|
+
super();
|
|
1430
|
+
this.round = round;
|
|
1431
|
+
this.attribute_map = {
|
|
1432
|
+
round: 'round',
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
// eslint-disable-next-line camelcase
|
|
1436
|
+
static from_obj_for_encoding(data) {
|
|
1437
|
+
/* eslint-disable dot-notation */
|
|
1438
|
+
if (typeof data['round'] === 'undefined')
|
|
1439
|
+
throw new Error(`Response is missing required field 'round': ${data}`);
|
|
1440
|
+
return new GetSyncRoundResponse({
|
|
1441
|
+
round: data['round'],
|
|
1442
|
+
});
|
|
1443
|
+
/* eslint-enable dot-notation */
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
exports.GetSyncRoundResponse = GetSyncRoundResponse;
|
|
1447
|
+
/**
|
|
1448
|
+
* A single Delta containing the key, the previous value and the current value for
|
|
1449
|
+
* a single round.
|
|
1450
|
+
*/
|
|
1451
|
+
class KvDelta extends basemodel_1.default {
|
|
1452
|
+
/**
|
|
1453
|
+
* Creates a new `KvDelta` object.
|
|
1454
|
+
* @param key - The key, base64 encoded.
|
|
1455
|
+
* @param value - The new value of the KV store entry, base64 encoded.
|
|
1456
|
+
*/
|
|
1457
|
+
constructor({ key, value, }) {
|
|
1458
|
+
super();
|
|
1459
|
+
this.key =
|
|
1460
|
+
typeof key === 'string'
|
|
1461
|
+
? new Uint8Array(buffer_1.Buffer.from(key, 'base64'))
|
|
1462
|
+
: key;
|
|
1463
|
+
this.value =
|
|
1464
|
+
typeof value === 'string'
|
|
1465
|
+
? new Uint8Array(buffer_1.Buffer.from(value, 'base64'))
|
|
1466
|
+
: value;
|
|
1467
|
+
this.attribute_map = {
|
|
1468
|
+
key: 'key',
|
|
1469
|
+
value: 'value',
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
// eslint-disable-next-line camelcase
|
|
1473
|
+
static from_obj_for_encoding(data) {
|
|
1474
|
+
/* eslint-disable dot-notation */
|
|
1475
|
+
return new KvDelta({
|
|
1476
|
+
key: data['key'],
|
|
1477
|
+
value: data['value'],
|
|
1478
|
+
});
|
|
1479
|
+
/* eslint-enable dot-notation */
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
exports.KvDelta = KvDelta;
|
|
1393
1483
|
/**
|
|
1394
1484
|
* Proof of membership and position of a light block header.
|
|
1395
1485
|
*/
|
|
@@ -1465,8 +1555,16 @@ class NodeStatusResponse extends basemodel_1.default {
|
|
|
1465
1555
|
* @param catchpointVerifiedKvs - The number of key-values (KVs) from the current catchpoint that have been
|
|
1466
1556
|
* verified so far as part of the catchup
|
|
1467
1557
|
* @param lastCatchpoint - The last catchpoint seen by the node
|
|
1558
|
+
* @param upgradeDelay - Upgrade delay
|
|
1559
|
+
* @param upgradeNextProtocolVoteBefore - Next protocol round
|
|
1560
|
+
* @param upgradeNoVotes - No votes cast for consensus upgrade
|
|
1561
|
+
* @param upgradeNodeVote - This node's upgrade vote
|
|
1562
|
+
* @param upgradeVoteRounds - Total voting rounds for current upgrade
|
|
1563
|
+
* @param upgradeVotes - Total votes cast for consensus upgrade
|
|
1564
|
+
* @param upgradeVotesRequired - Yes votes required for consensus upgrade
|
|
1565
|
+
* @param upgradeYesVotes - Yes votes cast for consensus upgrade
|
|
1468
1566
|
*/
|
|
1469
|
-
constructor({ catchupTime, lastRound, lastVersion, nextVersion, nextVersionRound, nextVersionSupported, stoppedAtUnsupportedRound, timeSinceLastRound, catchpoint, catchpointAcquiredBlocks, catchpointProcessedAccounts, catchpointProcessedKvs, catchpointTotalAccounts, catchpointTotalBlocks, catchpointTotalKvs, catchpointVerifiedAccounts, catchpointVerifiedKvs, lastCatchpoint, }) {
|
|
1567
|
+
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, }) {
|
|
1470
1568
|
super();
|
|
1471
1569
|
this.catchupTime = catchupTime;
|
|
1472
1570
|
this.lastRound = lastRound;
|
|
@@ -1486,6 +1584,14 @@ class NodeStatusResponse extends basemodel_1.default {
|
|
|
1486
1584
|
this.catchpointVerifiedAccounts = catchpointVerifiedAccounts;
|
|
1487
1585
|
this.catchpointVerifiedKvs = catchpointVerifiedKvs;
|
|
1488
1586
|
this.lastCatchpoint = lastCatchpoint;
|
|
1587
|
+
this.upgradeDelay = upgradeDelay;
|
|
1588
|
+
this.upgradeNextProtocolVoteBefore = upgradeNextProtocolVoteBefore;
|
|
1589
|
+
this.upgradeNoVotes = upgradeNoVotes;
|
|
1590
|
+
this.upgradeNodeVote = upgradeNodeVote;
|
|
1591
|
+
this.upgradeVoteRounds = upgradeVoteRounds;
|
|
1592
|
+
this.upgradeVotes = upgradeVotes;
|
|
1593
|
+
this.upgradeVotesRequired = upgradeVotesRequired;
|
|
1594
|
+
this.upgradeYesVotes = upgradeYesVotes;
|
|
1489
1595
|
this.attribute_map = {
|
|
1490
1596
|
catchupTime: 'catchup-time',
|
|
1491
1597
|
lastRound: 'last-round',
|
|
@@ -1505,6 +1611,14 @@ class NodeStatusResponse extends basemodel_1.default {
|
|
|
1505
1611
|
catchpointVerifiedAccounts: 'catchpoint-verified-accounts',
|
|
1506
1612
|
catchpointVerifiedKvs: 'catchpoint-verified-kvs',
|
|
1507
1613
|
lastCatchpoint: 'last-catchpoint',
|
|
1614
|
+
upgradeDelay: 'upgrade-delay',
|
|
1615
|
+
upgradeNextProtocolVoteBefore: 'upgrade-next-protocol-vote-before',
|
|
1616
|
+
upgradeNoVotes: 'upgrade-no-votes',
|
|
1617
|
+
upgradeNodeVote: 'upgrade-node-vote',
|
|
1618
|
+
upgradeVoteRounds: 'upgrade-vote-rounds',
|
|
1619
|
+
upgradeVotes: 'upgrade-votes',
|
|
1620
|
+
upgradeVotesRequired: 'upgrade-votes-required',
|
|
1621
|
+
upgradeYesVotes: 'upgrade-yes-votes',
|
|
1508
1622
|
};
|
|
1509
1623
|
}
|
|
1510
1624
|
// eslint-disable-next-line camelcase
|
|
@@ -1545,6 +1659,14 @@ class NodeStatusResponse extends basemodel_1.default {
|
|
|
1545
1659
|
catchpointVerifiedAccounts: data['catchpoint-verified-accounts'],
|
|
1546
1660
|
catchpointVerifiedKvs: data['catchpoint-verified-kvs'],
|
|
1547
1661
|
lastCatchpoint: data['last-catchpoint'],
|
|
1662
|
+
upgradeDelay: data['upgrade-delay'],
|
|
1663
|
+
upgradeNextProtocolVoteBefore: data['upgrade-next-protocol-vote-before'],
|
|
1664
|
+
upgradeNoVotes: data['upgrade-no-votes'],
|
|
1665
|
+
upgradeNodeVote: data['upgrade-node-vote'],
|
|
1666
|
+
upgradeVoteRounds: data['upgrade-vote-rounds'],
|
|
1667
|
+
upgradeVotes: data['upgrade-votes'],
|
|
1668
|
+
upgradeVotesRequired: data['upgrade-votes-required'],
|
|
1669
|
+
upgradeYesVotes: data['upgrade-yes-votes'],
|
|
1548
1670
|
});
|
|
1549
1671
|
/* eslint-enable dot-notation */
|
|
1550
1672
|
}
|
|
@@ -1568,12 +1690,12 @@ class PendingTransactionResponse extends basemodel_1.default {
|
|
|
1568
1690
|
* @param closeRewards - Rewards in microalgos applied to the close remainder to account.
|
|
1569
1691
|
* @param closingAmount - Closing amount for the transaction.
|
|
1570
1692
|
* @param confirmedRound - The round where this transaction was confirmed, if present.
|
|
1571
|
-
* @param globalStateDelta -
|
|
1693
|
+
* @param globalStateDelta - Global state key/value changes for the application being executed by this
|
|
1572
1694
|
* transaction.
|
|
1573
1695
|
* @param innerTxns - Inner transactions produced by application execution.
|
|
1574
|
-
* @param localStateDelta -
|
|
1696
|
+
* @param localStateDelta - Local state key/value changes for the application being executed by this
|
|
1575
1697
|
* transaction.
|
|
1576
|
-
* @param logs -
|
|
1698
|
+
* @param logs - Logs for the application being executed by this transaction.
|
|
1577
1699
|
* @param receiverRewards - Rewards in microalgos applied to the receiver account.
|
|
1578
1700
|
* @param senderRewards - Rewards in microalgos applied to the sender account.
|
|
1579
1701
|
*/
|
|
@@ -1705,6 +1827,237 @@ class PostTransactionsResponse extends basemodel_1.default {
|
|
|
1705
1827
|
}
|
|
1706
1828
|
}
|
|
1707
1829
|
exports.PostTransactionsResponse = PostTransactionsResponse;
|
|
1830
|
+
/**
|
|
1831
|
+
* Request type for simulation endpoint.
|
|
1832
|
+
*/
|
|
1833
|
+
class SimulateRequest extends basemodel_1.default {
|
|
1834
|
+
/**
|
|
1835
|
+
* Creates a new `SimulateRequest` object.
|
|
1836
|
+
* @param txnGroups - The transaction groups to simulate.
|
|
1837
|
+
* @param allowEmptySignatures - Allow transactions without signatures to be simulated as if they had correct
|
|
1838
|
+
* signatures.
|
|
1839
|
+
* @param allowMoreLogging - Lifts limits on log opcode usage during simulation.
|
|
1840
|
+
*/
|
|
1841
|
+
constructor({ txnGroups, allowEmptySignatures, allowMoreLogging, }) {
|
|
1842
|
+
super();
|
|
1843
|
+
this.txnGroups = txnGroups;
|
|
1844
|
+
this.allowEmptySignatures = allowEmptySignatures;
|
|
1845
|
+
this.allowMoreLogging = allowMoreLogging;
|
|
1846
|
+
this.attribute_map = {
|
|
1847
|
+
txnGroups: 'txn-groups',
|
|
1848
|
+
allowEmptySignatures: 'allow-empty-signatures',
|
|
1849
|
+
allowMoreLogging: 'allow-more-logging',
|
|
1850
|
+
};
|
|
1851
|
+
}
|
|
1852
|
+
// eslint-disable-next-line camelcase
|
|
1853
|
+
static from_obj_for_encoding(data) {
|
|
1854
|
+
/* eslint-disable dot-notation */
|
|
1855
|
+
if (!Array.isArray(data['txn-groups']))
|
|
1856
|
+
throw new Error(`Response is missing required array field 'txn-groups': ${data}`);
|
|
1857
|
+
return new SimulateRequest({
|
|
1858
|
+
txnGroups: data['txn-groups'].map(SimulateRequestTransactionGroup.from_obj_for_encoding),
|
|
1859
|
+
allowEmptySignatures: data['allow-empty-signatures'],
|
|
1860
|
+
allowMoreLogging: data['allow-more-logging'],
|
|
1861
|
+
});
|
|
1862
|
+
/* eslint-enable dot-notation */
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
exports.SimulateRequest = SimulateRequest;
|
|
1866
|
+
/**
|
|
1867
|
+
* A transaction group to simulate.
|
|
1868
|
+
*/
|
|
1869
|
+
class SimulateRequestTransactionGroup extends basemodel_1.default {
|
|
1870
|
+
/**
|
|
1871
|
+
* Creates a new `SimulateRequestTransactionGroup` object.
|
|
1872
|
+
* @param txns - An atomic transaction group.
|
|
1873
|
+
*/
|
|
1874
|
+
constructor({ txns }) {
|
|
1875
|
+
super();
|
|
1876
|
+
this.txns = txns;
|
|
1877
|
+
this.attribute_map = {
|
|
1878
|
+
txns: 'txns',
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
// eslint-disable-next-line camelcase
|
|
1882
|
+
static from_obj_for_encoding(data) {
|
|
1883
|
+
/* eslint-disable dot-notation */
|
|
1884
|
+
if (!Array.isArray(data['txns']))
|
|
1885
|
+
throw new Error(`Response is missing required array field 'txns': ${data}`);
|
|
1886
|
+
return new SimulateRequestTransactionGroup({
|
|
1887
|
+
txns: data['txns'],
|
|
1888
|
+
});
|
|
1889
|
+
/* eslint-enable dot-notation */
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
exports.SimulateRequestTransactionGroup = SimulateRequestTransactionGroup;
|
|
1893
|
+
/**
|
|
1894
|
+
* Result of a transaction group simulation.
|
|
1895
|
+
*/
|
|
1896
|
+
class SimulateResponse extends basemodel_1.default {
|
|
1897
|
+
/**
|
|
1898
|
+
* Creates a new `SimulateResponse` object.
|
|
1899
|
+
* @param lastRound - The round immediately preceding this simulation. State changes through this
|
|
1900
|
+
* round were used to run this simulation.
|
|
1901
|
+
* @param txnGroups - A result object for each transaction group that was simulated.
|
|
1902
|
+
* @param version - The version of this response object.
|
|
1903
|
+
* @param evalOverrides - The set of parameters and limits override during simulation. If this set of
|
|
1904
|
+
* parameters is present, then evaluation parameters may differ from standard
|
|
1905
|
+
* evaluation in certain ways.
|
|
1906
|
+
*/
|
|
1907
|
+
constructor({ lastRound, txnGroups, version, evalOverrides, }) {
|
|
1908
|
+
super();
|
|
1909
|
+
this.lastRound = lastRound;
|
|
1910
|
+
this.txnGroups = txnGroups;
|
|
1911
|
+
this.version = version;
|
|
1912
|
+
this.evalOverrides = evalOverrides;
|
|
1913
|
+
this.attribute_map = {
|
|
1914
|
+
lastRound: 'last-round',
|
|
1915
|
+
txnGroups: 'txn-groups',
|
|
1916
|
+
version: 'version',
|
|
1917
|
+
evalOverrides: 'eval-overrides',
|
|
1918
|
+
};
|
|
1919
|
+
}
|
|
1920
|
+
// eslint-disable-next-line camelcase
|
|
1921
|
+
static from_obj_for_encoding(data) {
|
|
1922
|
+
/* eslint-disable dot-notation */
|
|
1923
|
+
if (typeof data['last-round'] === 'undefined')
|
|
1924
|
+
throw new Error(`Response is missing required field 'last-round': ${data}`);
|
|
1925
|
+
if (!Array.isArray(data['txn-groups']))
|
|
1926
|
+
throw new Error(`Response is missing required array field 'txn-groups': ${data}`);
|
|
1927
|
+
if (typeof data['version'] === 'undefined')
|
|
1928
|
+
throw new Error(`Response is missing required field 'version': ${data}`);
|
|
1929
|
+
return new SimulateResponse({
|
|
1930
|
+
lastRound: data['last-round'],
|
|
1931
|
+
txnGroups: data['txn-groups'].map(SimulateTransactionGroupResult.from_obj_for_encoding),
|
|
1932
|
+
version: data['version'],
|
|
1933
|
+
evalOverrides: typeof data['eval-overrides'] !== 'undefined'
|
|
1934
|
+
? SimulationEvalOverrides.from_obj_for_encoding(data['eval-overrides'])
|
|
1935
|
+
: undefined,
|
|
1936
|
+
});
|
|
1937
|
+
/* eslint-enable dot-notation */
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
exports.SimulateResponse = SimulateResponse;
|
|
1941
|
+
/**
|
|
1942
|
+
* Simulation result for an atomic transaction group
|
|
1943
|
+
*/
|
|
1944
|
+
class SimulateTransactionGroupResult extends basemodel_1.default {
|
|
1945
|
+
/**
|
|
1946
|
+
* Creates a new `SimulateTransactionGroupResult` object.
|
|
1947
|
+
* @param txnResults - Simulation result for individual transactions
|
|
1948
|
+
* @param appBudgetAdded - Total budget added during execution of app calls in the transaction group.
|
|
1949
|
+
* @param appBudgetConsumed - Total budget consumed during execution of app calls in the transaction group.
|
|
1950
|
+
* @param failedAt - If present, indicates which transaction in this group caused the failure. This
|
|
1951
|
+
* array represents the path to the failing transaction. Indexes are zero based,
|
|
1952
|
+
* the first element indicates the top-level transaction, and successive elements
|
|
1953
|
+
* indicate deeper inner transactions.
|
|
1954
|
+
* @param failureMessage - If present, indicates that the transaction group failed and specifies why that
|
|
1955
|
+
* happened
|
|
1956
|
+
*/
|
|
1957
|
+
constructor({ txnResults, appBudgetAdded, appBudgetConsumed, failedAt, failureMessage, }) {
|
|
1958
|
+
super();
|
|
1959
|
+
this.txnResults = txnResults;
|
|
1960
|
+
this.appBudgetAdded = appBudgetAdded;
|
|
1961
|
+
this.appBudgetConsumed = appBudgetConsumed;
|
|
1962
|
+
this.failedAt = failedAt;
|
|
1963
|
+
this.failureMessage = failureMessage;
|
|
1964
|
+
this.attribute_map = {
|
|
1965
|
+
txnResults: 'txn-results',
|
|
1966
|
+
appBudgetAdded: 'app-budget-added',
|
|
1967
|
+
appBudgetConsumed: 'app-budget-consumed',
|
|
1968
|
+
failedAt: 'failed-at',
|
|
1969
|
+
failureMessage: 'failure-message',
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
// eslint-disable-next-line camelcase
|
|
1973
|
+
static from_obj_for_encoding(data) {
|
|
1974
|
+
/* eslint-disable dot-notation */
|
|
1975
|
+
if (!Array.isArray(data['txn-results']))
|
|
1976
|
+
throw new Error(`Response is missing required array field 'txn-results': ${data}`);
|
|
1977
|
+
return new SimulateTransactionGroupResult({
|
|
1978
|
+
txnResults: data['txn-results'].map(SimulateTransactionResult.from_obj_for_encoding),
|
|
1979
|
+
appBudgetAdded: data['app-budget-added'],
|
|
1980
|
+
appBudgetConsumed: data['app-budget-consumed'],
|
|
1981
|
+
failedAt: data['failed-at'],
|
|
1982
|
+
failureMessage: data['failure-message'],
|
|
1983
|
+
});
|
|
1984
|
+
/* eslint-enable dot-notation */
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
exports.SimulateTransactionGroupResult = SimulateTransactionGroupResult;
|
|
1988
|
+
/**
|
|
1989
|
+
* Simulation result for an individual transaction
|
|
1990
|
+
*/
|
|
1991
|
+
class SimulateTransactionResult extends basemodel_1.default {
|
|
1992
|
+
/**
|
|
1993
|
+
* Creates a new `SimulateTransactionResult` object.
|
|
1994
|
+
* @param txnResult - Details about a pending transaction. If the transaction was recently confirmed,
|
|
1995
|
+
* includes confirmation details like the round and reward details.
|
|
1996
|
+
* @param appBudgetConsumed - Budget used during execution of an app call transaction. This value includes
|
|
1997
|
+
* budged used by inner app calls spawned by this transaction.
|
|
1998
|
+
* @param logicSigBudgetConsumed - Budget used during execution of a logic sig transaction.
|
|
1999
|
+
*/
|
|
2000
|
+
constructor({ txnResult, appBudgetConsumed, logicSigBudgetConsumed, }) {
|
|
2001
|
+
super();
|
|
2002
|
+
this.txnResult = txnResult;
|
|
2003
|
+
this.appBudgetConsumed = appBudgetConsumed;
|
|
2004
|
+
this.logicSigBudgetConsumed = logicSigBudgetConsumed;
|
|
2005
|
+
this.attribute_map = {
|
|
2006
|
+
txnResult: 'txn-result',
|
|
2007
|
+
appBudgetConsumed: 'app-budget-consumed',
|
|
2008
|
+
logicSigBudgetConsumed: 'logic-sig-budget-consumed',
|
|
2009
|
+
};
|
|
2010
|
+
}
|
|
2011
|
+
// eslint-disable-next-line camelcase
|
|
2012
|
+
static from_obj_for_encoding(data) {
|
|
2013
|
+
/* eslint-disable dot-notation */
|
|
2014
|
+
if (typeof data['txn-result'] === 'undefined')
|
|
2015
|
+
throw new Error(`Response is missing required field 'txn-result': ${data}`);
|
|
2016
|
+
return new SimulateTransactionResult({
|
|
2017
|
+
txnResult: PendingTransactionResponse.from_obj_for_encoding(data['txn-result']),
|
|
2018
|
+
appBudgetConsumed: data['app-budget-consumed'],
|
|
2019
|
+
logicSigBudgetConsumed: data['logic-sig-budget-consumed'],
|
|
2020
|
+
});
|
|
2021
|
+
/* eslint-enable dot-notation */
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
exports.SimulateTransactionResult = SimulateTransactionResult;
|
|
2025
|
+
/**
|
|
2026
|
+
* The set of parameters and limits override during simulation. If this set of
|
|
2027
|
+
* parameters is present, then evaluation parameters may differ from standard
|
|
2028
|
+
* evaluation in certain ways.
|
|
2029
|
+
*/
|
|
2030
|
+
class SimulationEvalOverrides extends basemodel_1.default {
|
|
2031
|
+
/**
|
|
2032
|
+
* Creates a new `SimulationEvalOverrides` object.
|
|
2033
|
+
* @param allowEmptySignatures - If true, transactions without signatures are allowed and simulated as if they
|
|
2034
|
+
* were properly signed.
|
|
2035
|
+
* @param maxLogCalls - The maximum log calls one can make during simulation
|
|
2036
|
+
* @param maxLogSize - The maximum byte number to log during simulation
|
|
2037
|
+
*/
|
|
2038
|
+
constructor({ allowEmptySignatures, maxLogCalls, maxLogSize, }) {
|
|
2039
|
+
super();
|
|
2040
|
+
this.allowEmptySignatures = allowEmptySignatures;
|
|
2041
|
+
this.maxLogCalls = maxLogCalls;
|
|
2042
|
+
this.maxLogSize = maxLogSize;
|
|
2043
|
+
this.attribute_map = {
|
|
2044
|
+
allowEmptySignatures: 'allow-empty-signatures',
|
|
2045
|
+
maxLogCalls: 'max-log-calls',
|
|
2046
|
+
maxLogSize: 'max-log-size',
|
|
2047
|
+
};
|
|
2048
|
+
}
|
|
2049
|
+
// eslint-disable-next-line camelcase
|
|
2050
|
+
static from_obj_for_encoding(data) {
|
|
2051
|
+
/* eslint-disable dot-notation */
|
|
2052
|
+
return new SimulationEvalOverrides({
|
|
2053
|
+
allowEmptySignatures: data['allow-empty-signatures'],
|
|
2054
|
+
maxLogCalls: data['max-log-calls'],
|
|
2055
|
+
maxLogSize: data['max-log-size'],
|
|
2056
|
+
});
|
|
2057
|
+
/* eslint-enable dot-notation */
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
exports.SimulationEvalOverrides = SimulationEvalOverrides;
|
|
1708
2061
|
/**
|
|
1709
2062
|
* Represents a state proof and its corresponding message
|
|
1710
2063
|
*/
|