algosdk 3.3.1 → 3.5.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 -5
- package/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/appAccess.js +261 -0
- package/dist/cjs/appAccess.js.map +1 -0
- package/dist/cjs/client/v2/algod/getTransactionProof.js +1 -1
- package/dist/cjs/client/v2/algod/getTransactionProof.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +8 -8
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/models/types.js +338 -8
- package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/searchForTransactions.js +19 -0
- package/dist/cjs/client/v2/indexer/searchForTransactions.js.map +1 -1
- package/dist/cjs/encoding/schema/bytearray.js +3 -0
- package/dist/cjs/encoding/schema/bytearray.js.map +1 -1
- package/dist/cjs/logicsig.js +54 -17
- package/dist/cjs/logicsig.js.map +1 -1
- package/dist/cjs/makeTxn.js +66 -12
- package/dist/cjs/makeTxn.js.map +1 -1
- package/dist/cjs/signing.js +4 -4
- package/dist/cjs/signing.js.map +1 -1
- package/dist/cjs/transaction.js +107 -0
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/esm/appAccess.js +255 -0
- package/dist/esm/appAccess.js.map +1 -0
- package/dist/esm/client/v2/algod/getTransactionProof.js +2 -2
- package/dist/esm/client/v2/algod/getTransactionProof.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +6 -6
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/models/types.js +332 -6
- package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/searchForTransactions.js +19 -0
- package/dist/esm/client/v2/indexer/searchForTransactions.js.map +1 -1
- package/dist/esm/encoding/schema/bytearray.js +3 -0
- package/dist/esm/encoding/schema/bytearray.js.map +1 -1
- package/dist/esm/logicsig.js +54 -17
- package/dist/esm/logicsig.js.map +1 -1
- package/dist/esm/makeTxn.js +66 -12
- package/dist/esm/makeTxn.js.map +1 -1
- package/dist/esm/signing.js +4 -4
- package/dist/esm/signing.js.map +1 -1
- package/dist/esm/transaction.js +107 -0
- package/dist/esm/transaction.js.map +1 -1
- package/dist/types/appAccess.d.ts +28 -0
- package/dist/types/client/v2/algod/getTransactionProof.d.ts +3 -3
- package/dist/types/client/v2/algod/models/types.d.ts +4 -4
- package/dist/types/client/v2/indexer/models/types.d.ts +202 -8
- package/dist/types/client/v2/indexer/searchForTransactions.d.ts +16 -0
- package/dist/types/logicsig.d.ts +2 -0
- package/dist/types/makeTxn.d.ts +9 -9
- package/dist/types/transaction.d.ts +17 -0
- package/dist/types/types/transactions/base.d.ts +71 -0
- package/package.json +2 -2
- package/src/appAccess.ts +298 -0
- package/src/client/v2/algod/getTransactionProof.ts +4 -4
- package/src/client/v2/algod/models/types.ts +7 -7
- package/src/client/v2/indexer/models/types.ts +542 -5
- package/src/client/v2/indexer/searchForTransactions.ts +20 -0
- package/src/encoding/schema/bytearray.ts +3 -0
- package/src/logicsig.ts +68 -17
- package/src/makeTxn.ts +110 -12
- package/src/signing.ts +4 -4
- package/src/transaction.ts +162 -0
- package/src/types/transactions/base.ts +85 -0
|
@@ -1801,6 +1801,10 @@ export class Block {
|
|
|
1801
1801
|
key: 'participation-updates',
|
|
1802
1802
|
valueSchema: new OptionalSchema(ParticipationUpdates.encodingSchema),
|
|
1803
1803
|
omitEmpty: true,
|
|
1804
|
+
}, {
|
|
1805
|
+
key: 'previous-block-hash-512',
|
|
1806
|
+
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
1807
|
+
omitEmpty: true,
|
|
1804
1808
|
}, {
|
|
1805
1809
|
key: 'proposer',
|
|
1806
1810
|
valueSchema: new OptionalSchema(new StringSchema()),
|
|
@@ -1821,6 +1825,10 @@ export class Block {
|
|
|
1821
1825
|
key: 'transactions',
|
|
1822
1826
|
valueSchema: new OptionalSchema(new ArraySchema(Transaction.encodingSchema)),
|
|
1823
1827
|
omitEmpty: true,
|
|
1828
|
+
}, {
|
|
1829
|
+
key: 'transactions-root-sha512',
|
|
1830
|
+
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
1831
|
+
omitEmpty: true,
|
|
1824
1832
|
}, {
|
|
1825
1833
|
key: 'txn-counter',
|
|
1826
1834
|
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
@@ -1858,11 +1866,15 @@ export class Block {
|
|
|
1858
1866
|
* @param bonus - the potential bonus payout for this block.
|
|
1859
1867
|
* @param feesCollected - the sum of all fees paid by transactions in this block.
|
|
1860
1868
|
* @param participationUpdates - Participation account data that needs to be checked/acted on by the network.
|
|
1869
|
+
* @param previousBlockHash512 - (prev512) Previous block hash, using SHA-512.
|
|
1861
1870
|
* @param proposer - the proposer of this block.
|
|
1862
1871
|
* @param proposerPayout - the actual amount transferred to the proposer from the fee sink.
|
|
1863
1872
|
* @param rewards - Fields relating to rewards,
|
|
1864
1873
|
* @param stateProofTracking - Tracks the status of state proofs.
|
|
1865
1874
|
* @param transactions - (txns) list of transactions corresponding to a given round.
|
|
1875
|
+
* @param transactionsRootSha512 - (txn512) TransactionsRootSHA512 is an auxiliary TransactionRoot, built using a
|
|
1876
|
+
* vector commitment instead of a merkle tree, and SHA512 hash function instead of
|
|
1877
|
+
* the default SHA512_256.
|
|
1866
1878
|
* @param txnCounter - (tc) TxnCounter counts the number of transactions committed in the ledger, from
|
|
1867
1879
|
* the time at which support for this feature was introduced.
|
|
1868
1880
|
* Specifically, TxnCounter is the number of the next transaction that will be
|
|
@@ -1871,7 +1883,7 @@ export class Block {
|
|
|
1871
1883
|
* @param upgradeState - Fields relating to a protocol upgrade.
|
|
1872
1884
|
* @param upgradeVote - Fields relating to voting for a protocol upgrade.
|
|
1873
1885
|
*/
|
|
1874
|
-
constructor({ genesisHash, genesisId, previousBlockHash, round, seed, timestamp, transactionsRoot, transactionsRootSha256, bonus, feesCollected, participationUpdates, proposer, proposerPayout, rewards, stateProofTracking, transactions, txnCounter, upgradeState, upgradeVote, }) {
|
|
1886
|
+
constructor({ genesisHash, genesisId, previousBlockHash, round, seed, timestamp, transactionsRoot, transactionsRootSha256, bonus, feesCollected, participationUpdates, previousBlockHash512, proposer, proposerPayout, rewards, stateProofTracking, transactions, transactionsRootSha512, txnCounter, upgradeState, upgradeVote, }) {
|
|
1875
1887
|
this.genesisHash =
|
|
1876
1888
|
typeof genesisHash === 'string'
|
|
1877
1889
|
? base64ToBytes(genesisHash)
|
|
@@ -1899,6 +1911,10 @@ export class Block {
|
|
|
1899
1911
|
? undefined
|
|
1900
1912
|
: ensureSafeInteger(feesCollected);
|
|
1901
1913
|
this.participationUpdates = participationUpdates;
|
|
1914
|
+
this.previousBlockHash512 =
|
|
1915
|
+
typeof previousBlockHash512 === 'string'
|
|
1916
|
+
? base64ToBytes(previousBlockHash512)
|
|
1917
|
+
: previousBlockHash512;
|
|
1902
1918
|
this.proposer =
|
|
1903
1919
|
typeof proposer === 'string' ? Address.fromString(proposer) : proposer;
|
|
1904
1920
|
this.proposerPayout =
|
|
@@ -1908,6 +1924,10 @@ export class Block {
|
|
|
1908
1924
|
this.rewards = rewards;
|
|
1909
1925
|
this.stateProofTracking = stateProofTracking;
|
|
1910
1926
|
this.transactions = transactions;
|
|
1927
|
+
this.transactionsRootSha512 =
|
|
1928
|
+
typeof transactionsRootSha512 === 'string'
|
|
1929
|
+
? base64ToBytes(transactionsRootSha512)
|
|
1930
|
+
: transactionsRootSha512;
|
|
1911
1931
|
this.txnCounter =
|
|
1912
1932
|
typeof txnCounter === 'undefined'
|
|
1913
1933
|
? undefined
|
|
@@ -1937,6 +1957,7 @@ export class Block {
|
|
|
1937
1957
|
? this.participationUpdates.toEncodingData()
|
|
1938
1958
|
: undefined,
|
|
1939
1959
|
],
|
|
1960
|
+
['previous-block-hash-512', this.previousBlockHash512],
|
|
1940
1961
|
[
|
|
1941
1962
|
'proposer',
|
|
1942
1963
|
typeof this.proposer !== 'undefined'
|
|
@@ -1962,6 +1983,7 @@ export class Block {
|
|
|
1962
1983
|
? this.transactions.map((v) => v.toEncodingData())
|
|
1963
1984
|
: undefined,
|
|
1964
1985
|
],
|
|
1986
|
+
['transactions-root-sha512', this.transactionsRootSha512],
|
|
1965
1987
|
['txn-counter', this.txnCounter],
|
|
1966
1988
|
[
|
|
1967
1989
|
'upgrade-state',
|
|
@@ -1995,6 +2017,7 @@ export class Block {
|
|
|
1995
2017
|
participationUpdates: typeof data.get('participation-updates') !== 'undefined'
|
|
1996
2018
|
? ParticipationUpdates.fromEncodingData(data.get('participation-updates'))
|
|
1997
2019
|
: undefined,
|
|
2020
|
+
previousBlockHash512: data.get('previous-block-hash-512'),
|
|
1998
2021
|
proposer: data.get('proposer'),
|
|
1999
2022
|
proposerPayout: data.get('proposer-payout'),
|
|
2000
2023
|
rewards: typeof data.get('rewards') !== 'undefined'
|
|
@@ -2010,6 +2033,7 @@ export class Block {
|
|
|
2010
2033
|
.get('transactions')
|
|
2011
2034
|
.map((v) => Transaction.fromEncodingData(v))
|
|
2012
2035
|
: undefined,
|
|
2036
|
+
transactionsRootSha512: data.get('transactions-root-sha512'),
|
|
2013
2037
|
txnCounter: data.get('txn-counter'),
|
|
2014
2038
|
upgradeState: typeof data.get('upgrade-state') !== 'undefined'
|
|
2015
2039
|
? BlockUpgradeState.fromEncodingData(data.get('upgrade-state'))
|
|
@@ -2381,6 +2405,47 @@ export class BoxDescriptor {
|
|
|
2381
2405
|
});
|
|
2382
2406
|
}
|
|
2383
2407
|
}
|
|
2408
|
+
/**
|
|
2409
|
+
* BoxReference names a box by its name and the application ID it belongs to.
|
|
2410
|
+
*/
|
|
2411
|
+
export class BoxReference {
|
|
2412
|
+
static get encodingSchema() {
|
|
2413
|
+
if (!this.encodingSchemaValue) {
|
|
2414
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2415
|
+
this.encodingSchemaValue.pushEntries({ key: 'app', valueSchema: new Uint64Schema(), omitEmpty: true }, { key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true });
|
|
2416
|
+
}
|
|
2417
|
+
return this.encodingSchemaValue;
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* Creates a new `BoxReference` object.
|
|
2421
|
+
* @param app - Application ID to which the box belongs, or zero if referring to the called
|
|
2422
|
+
* application.
|
|
2423
|
+
* @param name - Base64 encoded box name
|
|
2424
|
+
*/
|
|
2425
|
+
constructor({ app, name, }) {
|
|
2426
|
+
this.app = ensureSafeInteger(app);
|
|
2427
|
+
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
2428
|
+
}
|
|
2429
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2430
|
+
getEncodingSchema() {
|
|
2431
|
+
return BoxReference.encodingSchema;
|
|
2432
|
+
}
|
|
2433
|
+
toEncodingData() {
|
|
2434
|
+
return new Map([
|
|
2435
|
+
['app', this.app],
|
|
2436
|
+
['name', this.name],
|
|
2437
|
+
]);
|
|
2438
|
+
}
|
|
2439
|
+
static fromEncodingData(data) {
|
|
2440
|
+
if (!(data instanceof Map)) {
|
|
2441
|
+
throw new Error(`Invalid decoded BoxReference: ${data}`);
|
|
2442
|
+
}
|
|
2443
|
+
return new BoxReference({
|
|
2444
|
+
app: data.get('app'),
|
|
2445
|
+
name: data.get('name'),
|
|
2446
|
+
});
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2384
2449
|
/**
|
|
2385
2450
|
* Box names of an application
|
|
2386
2451
|
*/
|
|
@@ -2777,6 +2842,47 @@ export class HealthCheck {
|
|
|
2777
2842
|
});
|
|
2778
2843
|
}
|
|
2779
2844
|
}
|
|
2845
|
+
/**
|
|
2846
|
+
* HoldingRef names a holding by referring to an Address and Asset it belongs to.
|
|
2847
|
+
*/
|
|
2848
|
+
export class HoldingRef {
|
|
2849
|
+
static get encodingSchema() {
|
|
2850
|
+
if (!this.encodingSchemaValue) {
|
|
2851
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2852
|
+
this.encodingSchemaValue.pushEntries({ key: 'address', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'asset', valueSchema: new Uint64Schema(), omitEmpty: true });
|
|
2853
|
+
}
|
|
2854
|
+
return this.encodingSchemaValue;
|
|
2855
|
+
}
|
|
2856
|
+
/**
|
|
2857
|
+
* Creates a new `HoldingRef` object.
|
|
2858
|
+
* @param address - (d) Address in access list, or the sender of the transaction.
|
|
2859
|
+
* @param asset - (s) Asset ID for asset in access list.
|
|
2860
|
+
*/
|
|
2861
|
+
constructor({ address, asset, }) {
|
|
2862
|
+
this.address =
|
|
2863
|
+
typeof address === 'string' ? Address.fromString(address) : address;
|
|
2864
|
+
this.asset = ensureSafeInteger(asset);
|
|
2865
|
+
}
|
|
2866
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2867
|
+
getEncodingSchema() {
|
|
2868
|
+
return HoldingRef.encodingSchema;
|
|
2869
|
+
}
|
|
2870
|
+
toEncodingData() {
|
|
2871
|
+
return new Map([
|
|
2872
|
+
['address', this.address.toString()],
|
|
2873
|
+
['asset', this.asset],
|
|
2874
|
+
]);
|
|
2875
|
+
}
|
|
2876
|
+
static fromEncodingData(data) {
|
|
2877
|
+
if (!(data instanceof Map)) {
|
|
2878
|
+
throw new Error(`Invalid decoded HoldingRef: ${data}`);
|
|
2879
|
+
}
|
|
2880
|
+
return new HoldingRef({
|
|
2881
|
+
address: data.get('address'),
|
|
2882
|
+
asset: data.get('asset'),
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2780
2886
|
export class IndexerStateProofMessage {
|
|
2781
2887
|
static get encodingSchema() {
|
|
2782
2888
|
if (!this.encodingSchemaValue) {
|
|
@@ -2861,6 +2967,48 @@ export class IndexerStateProofMessage {
|
|
|
2861
2967
|
});
|
|
2862
2968
|
}
|
|
2863
2969
|
}
|
|
2970
|
+
/**
|
|
2971
|
+
* LocalsRef names a local state by referring to an Address and App it belongs to.
|
|
2972
|
+
*/
|
|
2973
|
+
export class LocalsRef {
|
|
2974
|
+
static get encodingSchema() {
|
|
2975
|
+
if (!this.encodingSchemaValue) {
|
|
2976
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
2977
|
+
this.encodingSchemaValue.pushEntries({ key: 'address', valueSchema: new StringSchema(), omitEmpty: true }, { key: 'app', valueSchema: new Uint64Schema(), omitEmpty: true });
|
|
2978
|
+
}
|
|
2979
|
+
return this.encodingSchemaValue;
|
|
2980
|
+
}
|
|
2981
|
+
/**
|
|
2982
|
+
* Creates a new `LocalsRef` object.
|
|
2983
|
+
* @param address - (d) Address in access list, or the sender of the transaction.
|
|
2984
|
+
* @param app - (p) Application ID for app in access list, or zero if referring to the called
|
|
2985
|
+
* application.
|
|
2986
|
+
*/
|
|
2987
|
+
constructor({ address, app, }) {
|
|
2988
|
+
this.address =
|
|
2989
|
+
typeof address === 'string' ? Address.fromString(address) : address;
|
|
2990
|
+
this.app = ensureSafeInteger(app);
|
|
2991
|
+
}
|
|
2992
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2993
|
+
getEncodingSchema() {
|
|
2994
|
+
return LocalsRef.encodingSchema;
|
|
2995
|
+
}
|
|
2996
|
+
toEncodingData() {
|
|
2997
|
+
return new Map([
|
|
2998
|
+
['address', this.address.toString()],
|
|
2999
|
+
['app', this.app],
|
|
3000
|
+
]);
|
|
3001
|
+
}
|
|
3002
|
+
static fromEncodingData(data) {
|
|
3003
|
+
if (!(data instanceof Map)) {
|
|
3004
|
+
throw new Error(`Invalid decoded LocalsRef: ${data}`);
|
|
3005
|
+
}
|
|
3006
|
+
return new LocalsRef({
|
|
3007
|
+
address: data.get('address'),
|
|
3008
|
+
app: data.get('app'),
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
2864
3012
|
export class MerkleArrayProof {
|
|
2865
3013
|
static get encodingSchema() {
|
|
2866
3014
|
if (!this.encodingSchemaValue) {
|
|
@@ -3047,6 +3195,118 @@ export class ParticipationUpdates {
|
|
|
3047
3195
|
});
|
|
3048
3196
|
}
|
|
3049
3197
|
}
|
|
3198
|
+
/**
|
|
3199
|
+
* ResourceRef names a single resource. Only one of the fields should be set.
|
|
3200
|
+
*/
|
|
3201
|
+
export class ResourceRef {
|
|
3202
|
+
static get encodingSchema() {
|
|
3203
|
+
if (!this.encodingSchemaValue) {
|
|
3204
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3205
|
+
this.encodingSchemaValue.pushEntries({
|
|
3206
|
+
key: 'address',
|
|
3207
|
+
valueSchema: new OptionalSchema(new StringSchema()),
|
|
3208
|
+
omitEmpty: true,
|
|
3209
|
+
}, {
|
|
3210
|
+
key: 'application-id',
|
|
3211
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
3212
|
+
omitEmpty: true,
|
|
3213
|
+
}, {
|
|
3214
|
+
key: 'asset-id',
|
|
3215
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
3216
|
+
omitEmpty: true,
|
|
3217
|
+
}, {
|
|
3218
|
+
key: 'box',
|
|
3219
|
+
valueSchema: new OptionalSchema(BoxReference.encodingSchema),
|
|
3220
|
+
omitEmpty: true,
|
|
3221
|
+
}, {
|
|
3222
|
+
key: 'holding',
|
|
3223
|
+
valueSchema: new OptionalSchema(HoldingRef.encodingSchema),
|
|
3224
|
+
omitEmpty: true,
|
|
3225
|
+
}, {
|
|
3226
|
+
key: 'local',
|
|
3227
|
+
valueSchema: new OptionalSchema(LocalsRef.encodingSchema),
|
|
3228
|
+
omitEmpty: true,
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
return this.encodingSchemaValue;
|
|
3232
|
+
}
|
|
3233
|
+
/**
|
|
3234
|
+
* Creates a new `ResourceRef` object.
|
|
3235
|
+
* @param address - (d) Account whose balance record is accessible by the executing ApprovalProgram
|
|
3236
|
+
* or ClearStateProgram.
|
|
3237
|
+
* @param applicationId - (p) Application id whose GlobalState may be read by the executing
|
|
3238
|
+
* ApprovalProgram or ClearStateProgram.
|
|
3239
|
+
* @param assetId - (s) Asset whose AssetParams may be read by the executing
|
|
3240
|
+
* ApprovalProgram or ClearStateProgram.
|
|
3241
|
+
* @param box - BoxReference names a box by its name and the application ID it belongs to.
|
|
3242
|
+
* @param holding - HoldingRef names a holding by referring to an Address and Asset it belongs to.
|
|
3243
|
+
* @param local - LocalsRef names a local state by referring to an Address and App it belongs to.
|
|
3244
|
+
*/
|
|
3245
|
+
constructor({ address, applicationId, assetId, box, holding, local, }) {
|
|
3246
|
+
this.address =
|
|
3247
|
+
typeof address === 'string' ? Address.fromString(address) : address;
|
|
3248
|
+
this.applicationId =
|
|
3249
|
+
typeof applicationId === 'undefined'
|
|
3250
|
+
? undefined
|
|
3251
|
+
: ensureSafeInteger(applicationId);
|
|
3252
|
+
this.assetId =
|
|
3253
|
+
typeof assetId === 'undefined' ? undefined : ensureSafeInteger(assetId);
|
|
3254
|
+
this.box = box;
|
|
3255
|
+
this.holding = holding;
|
|
3256
|
+
this.local = local;
|
|
3257
|
+
}
|
|
3258
|
+
// eslint-disable-next-line class-methods-use-this
|
|
3259
|
+
getEncodingSchema() {
|
|
3260
|
+
return ResourceRef.encodingSchema;
|
|
3261
|
+
}
|
|
3262
|
+
toEncodingData() {
|
|
3263
|
+
return new Map([
|
|
3264
|
+
[
|
|
3265
|
+
'address',
|
|
3266
|
+
typeof this.address !== 'undefined'
|
|
3267
|
+
? this.address.toString()
|
|
3268
|
+
: undefined,
|
|
3269
|
+
],
|
|
3270
|
+
['application-id', this.applicationId],
|
|
3271
|
+
['asset-id', this.assetId],
|
|
3272
|
+
[
|
|
3273
|
+
'box',
|
|
3274
|
+
typeof this.box !== 'undefined' ? this.box.toEncodingData() : undefined,
|
|
3275
|
+
],
|
|
3276
|
+
[
|
|
3277
|
+
'holding',
|
|
3278
|
+
typeof this.holding !== 'undefined'
|
|
3279
|
+
? this.holding.toEncodingData()
|
|
3280
|
+
: undefined,
|
|
3281
|
+
],
|
|
3282
|
+
[
|
|
3283
|
+
'local',
|
|
3284
|
+
typeof this.local !== 'undefined'
|
|
3285
|
+
? this.local.toEncodingData()
|
|
3286
|
+
: undefined,
|
|
3287
|
+
],
|
|
3288
|
+
]);
|
|
3289
|
+
}
|
|
3290
|
+
static fromEncodingData(data) {
|
|
3291
|
+
if (!(data instanceof Map)) {
|
|
3292
|
+
throw new Error(`Invalid decoded ResourceRef: ${data}`);
|
|
3293
|
+
}
|
|
3294
|
+
return new ResourceRef({
|
|
3295
|
+
address: data.get('address'),
|
|
3296
|
+
applicationId: data.get('application-id'),
|
|
3297
|
+
assetId: data.get('asset-id'),
|
|
3298
|
+
box: typeof data.get('box') !== 'undefined'
|
|
3299
|
+
? BoxReference.fromEncodingData(data.get('box'))
|
|
3300
|
+
: undefined,
|
|
3301
|
+
holding: typeof data.get('holding') !== 'undefined'
|
|
3302
|
+
? HoldingRef.fromEncodingData(data.get('holding'))
|
|
3303
|
+
: undefined,
|
|
3304
|
+
local: typeof data.get('local') !== 'undefined'
|
|
3305
|
+
? LocalsRef.fromEncodingData(data.get('local'))
|
|
3306
|
+
: undefined,
|
|
3307
|
+
});
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3050
3310
|
/**
|
|
3051
3311
|
* (sp) represents a state proof.
|
|
3052
3312
|
* Definition:
|
|
@@ -4167,6 +4427,10 @@ export class TransactionApplication {
|
|
|
4167
4427
|
key: 'application-id',
|
|
4168
4428
|
valueSchema: new Uint64Schema(),
|
|
4169
4429
|
omitEmpty: true,
|
|
4430
|
+
}, {
|
|
4431
|
+
key: 'access',
|
|
4432
|
+
valueSchema: new OptionalSchema(new ArraySchema(ResourceRef.encodingSchema)),
|
|
4433
|
+
omitEmpty: true,
|
|
4170
4434
|
}, {
|
|
4171
4435
|
key: 'accounts',
|
|
4172
4436
|
valueSchema: new OptionalSchema(new ArraySchema(new StringSchema())),
|
|
@@ -4179,6 +4443,10 @@ export class TransactionApplication {
|
|
|
4179
4443
|
key: 'approval-program',
|
|
4180
4444
|
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
4181
4445
|
omitEmpty: true,
|
|
4446
|
+
}, {
|
|
4447
|
+
key: 'box-references',
|
|
4448
|
+
valueSchema: new OptionalSchema(new ArraySchema(BoxReference.encodingSchema)),
|
|
4449
|
+
omitEmpty: true,
|
|
4182
4450
|
}, {
|
|
4183
4451
|
key: 'clear-state-program',
|
|
4184
4452
|
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
@@ -4207,6 +4475,10 @@ export class TransactionApplication {
|
|
|
4207
4475
|
key: 'on-completion',
|
|
4208
4476
|
valueSchema: new OptionalSchema(new StringSchema()),
|
|
4209
4477
|
omitEmpty: true,
|
|
4478
|
+
}, {
|
|
4479
|
+
key: 'reject-version',
|
|
4480
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
4481
|
+
omitEmpty: true,
|
|
4210
4482
|
});
|
|
4211
4483
|
}
|
|
4212
4484
|
return this.encodingSchemaValue;
|
|
@@ -4214,6 +4486,9 @@ export class TransactionApplication {
|
|
|
4214
4486
|
/**
|
|
4215
4487
|
* Creates a new `TransactionApplication` object.
|
|
4216
4488
|
* @param applicationId - (apid) ID of the application being configured or empty if creating.
|
|
4489
|
+
* @param access - (al) Access unifies `accounts`, `foreign-apps`, `foreign-assets`, and
|
|
4490
|
+
* `box-references` under a single list. If access is non-empty, these lists must
|
|
4491
|
+
* be empty. If access is empty, those lists may be non-empty.
|
|
4217
4492
|
* @param accounts - (apat) List of accounts in addition to the sender that may be accessed from the
|
|
4218
4493
|
* application's approval-program and clear-state-program.
|
|
4219
4494
|
* @param applicationArgs - (apaa) transaction specific arguments accessed from the application's
|
|
@@ -4222,6 +4497,8 @@ export class TransactionApplication {
|
|
|
4222
4497
|
* on-completion is set to "clear". It can read and write global state for the
|
|
4223
4498
|
* application, as well as account-specific local state. Approval programs may
|
|
4224
4499
|
* reject the transaction.
|
|
4500
|
+
* @param boxReferences - (apbx) the boxes that can be accessed by this transaction (and others in the
|
|
4501
|
+
* same group).
|
|
4225
4502
|
* @param clearStateProgram - (apsu) Logic executed for application transactions with on-completion set to
|
|
4226
4503
|
* "clear". It can read and write global state for the application, as well as
|
|
4227
4504
|
* account-specific local state. Clear state programs cannot reject the
|
|
@@ -4249,9 +4526,12 @@ export class TransactionApplication {
|
|
|
4249
4526
|
* * update
|
|
4250
4527
|
* * update
|
|
4251
4528
|
* * delete
|
|
4529
|
+
* @param rejectVersion - (aprv) the lowest application version for which this transaction should
|
|
4530
|
+
* immediately fail. 0 indicates that no version check should be performed.
|
|
4252
4531
|
*/
|
|
4253
|
-
constructor({ applicationId, accounts, applicationArgs, approvalProgram, clearStateProgram, extraProgramPages, foreignApps, foreignAssets, globalStateSchema, localStateSchema, onCompletion, }) {
|
|
4532
|
+
constructor({ applicationId, access, accounts, applicationArgs, approvalProgram, boxReferences, clearStateProgram, extraProgramPages, foreignApps, foreignAssets, globalStateSchema, localStateSchema, onCompletion, rejectVersion, }) {
|
|
4254
4533
|
this.applicationId = ensureBigInt(applicationId);
|
|
4534
|
+
this.access = access;
|
|
4255
4535
|
this.accounts =
|
|
4256
4536
|
typeof accounts !== 'undefined'
|
|
4257
4537
|
? accounts.map((addr) => typeof addr === 'string' ? Address.fromString(addr) : addr)
|
|
@@ -4261,6 +4541,7 @@ export class TransactionApplication {
|
|
|
4261
4541
|
typeof approvalProgram === 'string'
|
|
4262
4542
|
? base64ToBytes(approvalProgram)
|
|
4263
4543
|
: approvalProgram;
|
|
4544
|
+
this.boxReferences = boxReferences;
|
|
4264
4545
|
this.clearStateProgram =
|
|
4265
4546
|
typeof clearStateProgram === 'string'
|
|
4266
4547
|
? base64ToBytes(clearStateProgram)
|
|
@@ -4280,6 +4561,10 @@ export class TransactionApplication {
|
|
|
4280
4561
|
this.globalStateSchema = globalStateSchema;
|
|
4281
4562
|
this.localStateSchema = localStateSchema;
|
|
4282
4563
|
this.onCompletion = onCompletion;
|
|
4564
|
+
this.rejectVersion =
|
|
4565
|
+
typeof rejectVersion === 'undefined'
|
|
4566
|
+
? undefined
|
|
4567
|
+
: ensureSafeInteger(rejectVersion);
|
|
4283
4568
|
}
|
|
4284
4569
|
// eslint-disable-next-line class-methods-use-this
|
|
4285
4570
|
getEncodingSchema() {
|
|
@@ -4288,6 +4573,12 @@ export class TransactionApplication {
|
|
|
4288
4573
|
toEncodingData() {
|
|
4289
4574
|
return new Map([
|
|
4290
4575
|
['application-id', this.applicationId],
|
|
4576
|
+
[
|
|
4577
|
+
'access',
|
|
4578
|
+
typeof this.access !== 'undefined'
|
|
4579
|
+
? this.access.map((v) => v.toEncodingData())
|
|
4580
|
+
: undefined,
|
|
4581
|
+
],
|
|
4291
4582
|
[
|
|
4292
4583
|
'accounts',
|
|
4293
4584
|
typeof this.accounts !== 'undefined'
|
|
@@ -4296,6 +4587,12 @@ export class TransactionApplication {
|
|
|
4296
4587
|
],
|
|
4297
4588
|
['application-args', this.applicationArgs],
|
|
4298
4589
|
['approval-program', this.approvalProgram],
|
|
4590
|
+
[
|
|
4591
|
+
'box-references',
|
|
4592
|
+
typeof this.boxReferences !== 'undefined'
|
|
4593
|
+
? this.boxReferences.map((v) => v.toEncodingData())
|
|
4594
|
+
: undefined,
|
|
4595
|
+
],
|
|
4299
4596
|
['clear-state-program', this.clearStateProgram],
|
|
4300
4597
|
['extra-program-pages', this.extraProgramPages],
|
|
4301
4598
|
['foreign-apps', this.foreignApps],
|
|
@@ -4313,6 +4610,7 @@ export class TransactionApplication {
|
|
|
4313
4610
|
: undefined,
|
|
4314
4611
|
],
|
|
4315
4612
|
['on-completion', this.onCompletion],
|
|
4613
|
+
['reject-version', this.rejectVersion],
|
|
4316
4614
|
]);
|
|
4317
4615
|
}
|
|
4318
4616
|
static fromEncodingData(data) {
|
|
@@ -4321,9 +4619,19 @@ export class TransactionApplication {
|
|
|
4321
4619
|
}
|
|
4322
4620
|
return new TransactionApplication({
|
|
4323
4621
|
applicationId: data.get('application-id'),
|
|
4622
|
+
access: typeof data.get('access') !== 'undefined'
|
|
4623
|
+
? data
|
|
4624
|
+
.get('access')
|
|
4625
|
+
.map((v) => ResourceRef.fromEncodingData(v))
|
|
4626
|
+
: undefined,
|
|
4324
4627
|
accounts: data.get('accounts'),
|
|
4325
4628
|
applicationArgs: data.get('application-args'),
|
|
4326
4629
|
approvalProgram: data.get('approval-program'),
|
|
4630
|
+
boxReferences: typeof data.get('box-references') !== 'undefined'
|
|
4631
|
+
? data
|
|
4632
|
+
.get('box-references')
|
|
4633
|
+
.map((v) => BoxReference.fromEncodingData(v))
|
|
4634
|
+
: undefined,
|
|
4327
4635
|
clearStateProgram: data.get('clear-state-program'),
|
|
4328
4636
|
extraProgramPages: data.get('extra-program-pages'),
|
|
4329
4637
|
foreignApps: data.get('foreign-apps'),
|
|
@@ -4335,6 +4643,7 @@ export class TransactionApplication {
|
|
|
4335
4643
|
? StateSchema.fromEncodingData(data.get('local-state-schema'))
|
|
4336
4644
|
: undefined,
|
|
4337
4645
|
onCompletion: data.get('on-completion'),
|
|
4646
|
+
rejectVersion: data.get('reject-version'),
|
|
4338
4647
|
});
|
|
4339
4648
|
}
|
|
4340
4649
|
}
|
|
@@ -4851,7 +5160,7 @@ export class TransactionSignature {
|
|
|
4851
5160
|
* @param logicsig - (lsig) Programatic transaction signature.
|
|
4852
5161
|
* Definition:
|
|
4853
5162
|
* data/transactions/logicsig.go
|
|
4854
|
-
* @param multisig -
|
|
5163
|
+
* @param multisig - structure holding multiple subsignatures.
|
|
4855
5164
|
* Definition:
|
|
4856
5165
|
* crypto/multisig.go : MultisigSig
|
|
4857
5166
|
* @param sig - (sig) Standard ed25519 signature.
|
|
@@ -4910,6 +5219,10 @@ export class TransactionSignatureLogicsig {
|
|
|
4910
5219
|
key: 'args',
|
|
4911
5220
|
valueSchema: new OptionalSchema(new ArraySchema(new ByteArraySchema())),
|
|
4912
5221
|
omitEmpty: true,
|
|
5222
|
+
}, {
|
|
5223
|
+
key: 'logic-multisig-signature',
|
|
5224
|
+
valueSchema: new OptionalSchema(TransactionSignatureMultisig.encodingSchema),
|
|
5225
|
+
omitEmpty: true,
|
|
4913
5226
|
}, {
|
|
4914
5227
|
key: 'multisig-signature',
|
|
4915
5228
|
valueSchema: new OptionalSchema(TransactionSignatureMultisig.encodingSchema),
|
|
@@ -4927,14 +5240,18 @@ export class TransactionSignatureLogicsig {
|
|
|
4927
5240
|
* @param logic - (l) Program signed by a signature or multi signature, or hashed to be the
|
|
4928
5241
|
* address of ana ccount. Base64 encoded TEAL program.
|
|
4929
5242
|
* @param args - (arg) Logic arguments, base64 encoded.
|
|
4930
|
-
* @param
|
|
5243
|
+
* @param logicMultisigSignature - structure holding multiple subsignatures.
|
|
5244
|
+
* Definition:
|
|
5245
|
+
* crypto/multisig.go : MultisigSig
|
|
5246
|
+
* @param multisigSignature - structure holding multiple subsignatures.
|
|
4931
5247
|
* Definition:
|
|
4932
5248
|
* crypto/multisig.go : MultisigSig
|
|
4933
5249
|
* @param signature - (sig) ed25519 signature.
|
|
4934
5250
|
*/
|
|
4935
|
-
constructor({ logic, args, multisigSignature, signature, }) {
|
|
5251
|
+
constructor({ logic, args, logicMultisigSignature, multisigSignature, signature, }) {
|
|
4936
5252
|
this.logic = typeof logic === 'string' ? base64ToBytes(logic) : logic;
|
|
4937
5253
|
this.args = args;
|
|
5254
|
+
this.logicMultisigSignature = logicMultisigSignature;
|
|
4938
5255
|
this.multisigSignature = multisigSignature;
|
|
4939
5256
|
this.signature =
|
|
4940
5257
|
typeof signature === 'string' ? base64ToBytes(signature) : signature;
|
|
@@ -4947,6 +5264,12 @@ export class TransactionSignatureLogicsig {
|
|
|
4947
5264
|
return new Map([
|
|
4948
5265
|
['logic', this.logic],
|
|
4949
5266
|
['args', this.args],
|
|
5267
|
+
[
|
|
5268
|
+
'logic-multisig-signature',
|
|
5269
|
+
typeof this.logicMultisigSignature !== 'undefined'
|
|
5270
|
+
? this.logicMultisigSignature.toEncodingData()
|
|
5271
|
+
: undefined,
|
|
5272
|
+
],
|
|
4950
5273
|
[
|
|
4951
5274
|
'multisig-signature',
|
|
4952
5275
|
typeof this.multisigSignature !== 'undefined'
|
|
@@ -4963,6 +5286,9 @@ export class TransactionSignatureLogicsig {
|
|
|
4963
5286
|
return new TransactionSignatureLogicsig({
|
|
4964
5287
|
logic: data.get('logic'),
|
|
4965
5288
|
args: data.get('args'),
|
|
5289
|
+
logicMultisigSignature: typeof data.get('logic-multisig-signature') !== 'undefined'
|
|
5290
|
+
? TransactionSignatureMultisig.fromEncodingData(data.get('logic-multisig-signature'))
|
|
5291
|
+
: undefined,
|
|
4966
5292
|
multisigSignature: typeof data.get('multisig-signature') !== 'undefined'
|
|
4967
5293
|
? TransactionSignatureMultisig.fromEncodingData(data.get('multisig-signature'))
|
|
4968
5294
|
: undefined,
|
|
@@ -4971,7 +5297,7 @@ export class TransactionSignatureLogicsig {
|
|
|
4971
5297
|
}
|
|
4972
5298
|
}
|
|
4973
5299
|
/**
|
|
4974
|
-
*
|
|
5300
|
+
* structure holding multiple subsignatures.
|
|
4975
5301
|
* Definition:
|
|
4976
5302
|
* crypto/multisig.go : MultisigSig
|
|
4977
5303
|
*/
|