algosdk 3.4.0 → 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 +4 -4
- 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/indexer/models/types.js +266 -8
- package/dist/cjs/client/v2/indexer/models/types.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/indexer/models/types.js +261 -6
- package/dist/esm/client/v2/indexer/models/types.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/indexer/models/types.d.ts +157 -8
- 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 +1 -1
- package/src/appAccess.ts +298 -0
- package/src/client/v2/indexer/models/types.ts +423 -5
- 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
|
@@ -3036,6 +3036,11 @@ export class Block implements Encodable {
|
|
|
3036
3036
|
valueSchema: new OptionalSchema(ParticipationUpdates.encodingSchema),
|
|
3037
3037
|
omitEmpty: true,
|
|
3038
3038
|
},
|
|
3039
|
+
{
|
|
3040
|
+
key: 'previous-block-hash-512',
|
|
3041
|
+
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
3042
|
+
omitEmpty: true,
|
|
3043
|
+
},
|
|
3039
3044
|
{
|
|
3040
3045
|
key: 'proposer',
|
|
3041
3046
|
valueSchema: new OptionalSchema(new StringSchema()),
|
|
@@ -3065,6 +3070,11 @@ export class Block implements Encodable {
|
|
|
3065
3070
|
),
|
|
3066
3071
|
omitEmpty: true,
|
|
3067
3072
|
},
|
|
3073
|
+
{
|
|
3074
|
+
key: 'transactions-root-sha512',
|
|
3075
|
+
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
3076
|
+
omitEmpty: true,
|
|
3077
|
+
},
|
|
3068
3078
|
{
|
|
3069
3079
|
key: 'txn-counter',
|
|
3070
3080
|
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
@@ -3148,6 +3158,11 @@ export class Block implements Encodable {
|
|
|
3148
3158
|
*/
|
|
3149
3159
|
public participationUpdates?: ParticipationUpdates;
|
|
3150
3160
|
|
|
3161
|
+
/**
|
|
3162
|
+
* (prev512) Previous block hash, using SHA-512.
|
|
3163
|
+
*/
|
|
3164
|
+
public previousBlockHash512?: Uint8Array;
|
|
3165
|
+
|
|
3151
3166
|
/**
|
|
3152
3167
|
* the proposer of this block.
|
|
3153
3168
|
*/
|
|
@@ -3173,6 +3188,13 @@ export class Block implements Encodable {
|
|
|
3173
3188
|
*/
|
|
3174
3189
|
public transactions?: Transaction[];
|
|
3175
3190
|
|
|
3191
|
+
/**
|
|
3192
|
+
* (txn512) TransactionsRootSHA512 is an auxiliary TransactionRoot, built using a
|
|
3193
|
+
* vector commitment instead of a merkle tree, and SHA512 hash function instead of
|
|
3194
|
+
* the default SHA512_256.
|
|
3195
|
+
*/
|
|
3196
|
+
public transactionsRootSha512?: Uint8Array;
|
|
3197
|
+
|
|
3176
3198
|
/**
|
|
3177
3199
|
* (tc) TxnCounter counts the number of transactions committed in the ledger, from
|
|
3178
3200
|
* the time at which support for this feature was introduced.
|
|
@@ -3213,11 +3235,15 @@ export class Block implements Encodable {
|
|
|
3213
3235
|
* @param bonus - the potential bonus payout for this block.
|
|
3214
3236
|
* @param feesCollected - the sum of all fees paid by transactions in this block.
|
|
3215
3237
|
* @param participationUpdates - Participation account data that needs to be checked/acted on by the network.
|
|
3238
|
+
* @param previousBlockHash512 - (prev512) Previous block hash, using SHA-512.
|
|
3216
3239
|
* @param proposer - the proposer of this block.
|
|
3217
3240
|
* @param proposerPayout - the actual amount transferred to the proposer from the fee sink.
|
|
3218
3241
|
* @param rewards - Fields relating to rewards,
|
|
3219
3242
|
* @param stateProofTracking - Tracks the status of state proofs.
|
|
3220
3243
|
* @param transactions - (txns) list of transactions corresponding to a given round.
|
|
3244
|
+
* @param transactionsRootSha512 - (txn512) TransactionsRootSHA512 is an auxiliary TransactionRoot, built using a
|
|
3245
|
+
* vector commitment instead of a merkle tree, and SHA512 hash function instead of
|
|
3246
|
+
* the default SHA512_256.
|
|
3221
3247
|
* @param txnCounter - (tc) TxnCounter counts the number of transactions committed in the ledger, from
|
|
3222
3248
|
* the time at which support for this feature was introduced.
|
|
3223
3249
|
* Specifically, TxnCounter is the number of the next transaction that will be
|
|
@@ -3238,11 +3264,13 @@ export class Block implements Encodable {
|
|
|
3238
3264
|
bonus,
|
|
3239
3265
|
feesCollected,
|
|
3240
3266
|
participationUpdates,
|
|
3267
|
+
previousBlockHash512,
|
|
3241
3268
|
proposer,
|
|
3242
3269
|
proposerPayout,
|
|
3243
3270
|
rewards,
|
|
3244
3271
|
stateProofTracking,
|
|
3245
3272
|
transactions,
|
|
3273
|
+
transactionsRootSha512,
|
|
3246
3274
|
txnCounter,
|
|
3247
3275
|
upgradeState,
|
|
3248
3276
|
upgradeVote,
|
|
@@ -3258,11 +3286,13 @@ export class Block implements Encodable {
|
|
|
3258
3286
|
bonus?: number | bigint;
|
|
3259
3287
|
feesCollected?: number | bigint;
|
|
3260
3288
|
participationUpdates?: ParticipationUpdates;
|
|
3289
|
+
previousBlockHash512?: string | Uint8Array;
|
|
3261
3290
|
proposer?: Address | string;
|
|
3262
3291
|
proposerPayout?: number | bigint;
|
|
3263
3292
|
rewards?: BlockRewards;
|
|
3264
3293
|
stateProofTracking?: StateProofTracking[];
|
|
3265
3294
|
transactions?: Transaction[];
|
|
3295
|
+
transactionsRootSha512?: string | Uint8Array;
|
|
3266
3296
|
txnCounter?: number | bigint;
|
|
3267
3297
|
upgradeState?: BlockUpgradeState;
|
|
3268
3298
|
upgradeVote?: BlockUpgradeVote;
|
|
@@ -3294,6 +3324,10 @@ export class Block implements Encodable {
|
|
|
3294
3324
|
? undefined
|
|
3295
3325
|
: ensureSafeInteger(feesCollected);
|
|
3296
3326
|
this.participationUpdates = participationUpdates;
|
|
3327
|
+
this.previousBlockHash512 =
|
|
3328
|
+
typeof previousBlockHash512 === 'string'
|
|
3329
|
+
? base64ToBytes(previousBlockHash512)
|
|
3330
|
+
: previousBlockHash512;
|
|
3297
3331
|
this.proposer =
|
|
3298
3332
|
typeof proposer === 'string' ? Address.fromString(proposer) : proposer;
|
|
3299
3333
|
this.proposerPayout =
|
|
@@ -3303,6 +3337,10 @@ export class Block implements Encodable {
|
|
|
3303
3337
|
this.rewards = rewards;
|
|
3304
3338
|
this.stateProofTracking = stateProofTracking;
|
|
3305
3339
|
this.transactions = transactions;
|
|
3340
|
+
this.transactionsRootSha512 =
|
|
3341
|
+
typeof transactionsRootSha512 === 'string'
|
|
3342
|
+
? base64ToBytes(transactionsRootSha512)
|
|
3343
|
+
: transactionsRootSha512;
|
|
3306
3344
|
this.txnCounter =
|
|
3307
3345
|
typeof txnCounter === 'undefined'
|
|
3308
3346
|
? undefined
|
|
@@ -3334,6 +3372,7 @@ export class Block implements Encodable {
|
|
|
3334
3372
|
? this.participationUpdates.toEncodingData()
|
|
3335
3373
|
: undefined,
|
|
3336
3374
|
],
|
|
3375
|
+
['previous-block-hash-512', this.previousBlockHash512],
|
|
3337
3376
|
[
|
|
3338
3377
|
'proposer',
|
|
3339
3378
|
typeof this.proposer !== 'undefined'
|
|
@@ -3359,6 +3398,7 @@ export class Block implements Encodable {
|
|
|
3359
3398
|
? this.transactions.map((v) => v.toEncodingData())
|
|
3360
3399
|
: undefined,
|
|
3361
3400
|
],
|
|
3401
|
+
['transactions-root-sha512', this.transactionsRootSha512],
|
|
3362
3402
|
['txn-counter', this.txnCounter],
|
|
3363
3403
|
[
|
|
3364
3404
|
'upgrade-state',
|
|
@@ -3396,6 +3436,7 @@ export class Block implements Encodable {
|
|
|
3396
3436
|
data.get('participation-updates')
|
|
3397
3437
|
)
|
|
3398
3438
|
: undefined,
|
|
3439
|
+
previousBlockHash512: data.get('previous-block-hash-512'),
|
|
3399
3440
|
proposer: data.get('proposer'),
|
|
3400
3441
|
proposerPayout: data.get('proposer-payout'),
|
|
3401
3442
|
rewards:
|
|
@@ -3414,6 +3455,7 @@ export class Block implements Encodable {
|
|
|
3414
3455
|
.get('transactions')
|
|
3415
3456
|
.map((v: unknown) => Transaction.fromEncodingData(v))
|
|
3416
3457
|
: undefined,
|
|
3458
|
+
transactionsRootSha512: data.get('transactions-root-sha512'),
|
|
3417
3459
|
txnCounter: data.get('txn-counter'),
|
|
3418
3460
|
upgradeState:
|
|
3419
3461
|
typeof data.get('upgrade-state') !== 'undefined'
|
|
@@ -4693,6 +4735,73 @@ export class HealthCheck implements Encodable {
|
|
|
4693
4735
|
}
|
|
4694
4736
|
}
|
|
4695
4737
|
|
|
4738
|
+
/**
|
|
4739
|
+
* HoldingRef names a holding by referring to an Address and Asset it belongs to.
|
|
4740
|
+
*/
|
|
4741
|
+
export class HoldingRef implements Encodable {
|
|
4742
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
4743
|
+
|
|
4744
|
+
static get encodingSchema(): Schema {
|
|
4745
|
+
if (!this.encodingSchemaValue) {
|
|
4746
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4747
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4748
|
+
{ key: 'address', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4749
|
+
{ key: 'asset', valueSchema: new Uint64Schema(), omitEmpty: true }
|
|
4750
|
+
);
|
|
4751
|
+
}
|
|
4752
|
+
return this.encodingSchemaValue;
|
|
4753
|
+
}
|
|
4754
|
+
|
|
4755
|
+
/**
|
|
4756
|
+
* (d) Address in access list, or the sender of the transaction.
|
|
4757
|
+
*/
|
|
4758
|
+
public address: Address;
|
|
4759
|
+
|
|
4760
|
+
/**
|
|
4761
|
+
* (s) Asset ID for asset in access list.
|
|
4762
|
+
*/
|
|
4763
|
+
public asset: number;
|
|
4764
|
+
|
|
4765
|
+
/**
|
|
4766
|
+
* Creates a new `HoldingRef` object.
|
|
4767
|
+
* @param address - (d) Address in access list, or the sender of the transaction.
|
|
4768
|
+
* @param asset - (s) Asset ID for asset in access list.
|
|
4769
|
+
*/
|
|
4770
|
+
constructor({
|
|
4771
|
+
address,
|
|
4772
|
+
asset,
|
|
4773
|
+
}: {
|
|
4774
|
+
address: Address | string;
|
|
4775
|
+
asset: number | bigint;
|
|
4776
|
+
}) {
|
|
4777
|
+
this.address =
|
|
4778
|
+
typeof address === 'string' ? Address.fromString(address) : address;
|
|
4779
|
+
this.asset = ensureSafeInteger(asset);
|
|
4780
|
+
}
|
|
4781
|
+
|
|
4782
|
+
// eslint-disable-next-line class-methods-use-this
|
|
4783
|
+
getEncodingSchema(): Schema {
|
|
4784
|
+
return HoldingRef.encodingSchema;
|
|
4785
|
+
}
|
|
4786
|
+
|
|
4787
|
+
toEncodingData(): Map<string, unknown> {
|
|
4788
|
+
return new Map<string, unknown>([
|
|
4789
|
+
['address', this.address.toString()],
|
|
4790
|
+
['asset', this.asset],
|
|
4791
|
+
]);
|
|
4792
|
+
}
|
|
4793
|
+
|
|
4794
|
+
static fromEncodingData(data: unknown): HoldingRef {
|
|
4795
|
+
if (!(data instanceof Map)) {
|
|
4796
|
+
throw new Error(`Invalid decoded HoldingRef: ${data}`);
|
|
4797
|
+
}
|
|
4798
|
+
return new HoldingRef({
|
|
4799
|
+
address: data.get('address'),
|
|
4800
|
+
asset: data.get('asset'),
|
|
4801
|
+
});
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
|
|
4696
4805
|
export class IndexerStateProofMessage implements Encodable {
|
|
4697
4806
|
private static encodingSchemaValue: Schema | undefined;
|
|
4698
4807
|
|
|
@@ -4827,6 +4936,75 @@ export class IndexerStateProofMessage implements Encodable {
|
|
|
4827
4936
|
}
|
|
4828
4937
|
}
|
|
4829
4938
|
|
|
4939
|
+
/**
|
|
4940
|
+
* LocalsRef names a local state by referring to an Address and App it belongs to.
|
|
4941
|
+
*/
|
|
4942
|
+
export class LocalsRef implements Encodable {
|
|
4943
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
4944
|
+
|
|
4945
|
+
static get encodingSchema(): Schema {
|
|
4946
|
+
if (!this.encodingSchemaValue) {
|
|
4947
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4948
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4949
|
+
{ key: 'address', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4950
|
+
{ key: 'app', valueSchema: new Uint64Schema(), omitEmpty: true }
|
|
4951
|
+
);
|
|
4952
|
+
}
|
|
4953
|
+
return this.encodingSchemaValue;
|
|
4954
|
+
}
|
|
4955
|
+
|
|
4956
|
+
/**
|
|
4957
|
+
* (d) Address in access list, or the sender of the transaction.
|
|
4958
|
+
*/
|
|
4959
|
+
public address: Address;
|
|
4960
|
+
|
|
4961
|
+
/**
|
|
4962
|
+
* (p) Application ID for app in access list, or zero if referring to the called
|
|
4963
|
+
* application.
|
|
4964
|
+
*/
|
|
4965
|
+
public app: number;
|
|
4966
|
+
|
|
4967
|
+
/**
|
|
4968
|
+
* Creates a new `LocalsRef` object.
|
|
4969
|
+
* @param address - (d) Address in access list, or the sender of the transaction.
|
|
4970
|
+
* @param app - (p) Application ID for app in access list, or zero if referring to the called
|
|
4971
|
+
* application.
|
|
4972
|
+
*/
|
|
4973
|
+
constructor({
|
|
4974
|
+
address,
|
|
4975
|
+
app,
|
|
4976
|
+
}: {
|
|
4977
|
+
address: Address | string;
|
|
4978
|
+
app: number | bigint;
|
|
4979
|
+
}) {
|
|
4980
|
+
this.address =
|
|
4981
|
+
typeof address === 'string' ? Address.fromString(address) : address;
|
|
4982
|
+
this.app = ensureSafeInteger(app);
|
|
4983
|
+
}
|
|
4984
|
+
|
|
4985
|
+
// eslint-disable-next-line class-methods-use-this
|
|
4986
|
+
getEncodingSchema(): Schema {
|
|
4987
|
+
return LocalsRef.encodingSchema;
|
|
4988
|
+
}
|
|
4989
|
+
|
|
4990
|
+
toEncodingData(): Map<string, unknown> {
|
|
4991
|
+
return new Map<string, unknown>([
|
|
4992
|
+
['address', this.address.toString()],
|
|
4993
|
+
['app', this.app],
|
|
4994
|
+
]);
|
|
4995
|
+
}
|
|
4996
|
+
|
|
4997
|
+
static fromEncodingData(data: unknown): LocalsRef {
|
|
4998
|
+
if (!(data instanceof Map)) {
|
|
4999
|
+
throw new Error(`Invalid decoded LocalsRef: ${data}`);
|
|
5000
|
+
}
|
|
5001
|
+
return new LocalsRef({
|
|
5002
|
+
address: data.get('address'),
|
|
5003
|
+
app: data.get('app'),
|
|
5004
|
+
});
|
|
5005
|
+
}
|
|
5006
|
+
}
|
|
5007
|
+
|
|
4830
5008
|
export class MerkleArrayProof implements Encodable {
|
|
4831
5009
|
private static encodingSchemaValue: Schema | undefined;
|
|
4832
5010
|
|
|
@@ -5123,6 +5301,182 @@ export class ParticipationUpdates implements Encodable {
|
|
|
5123
5301
|
}
|
|
5124
5302
|
}
|
|
5125
5303
|
|
|
5304
|
+
/**
|
|
5305
|
+
* ResourceRef names a single resource. Only one of the fields should be set.
|
|
5306
|
+
*/
|
|
5307
|
+
export class ResourceRef implements Encodable {
|
|
5308
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
5309
|
+
|
|
5310
|
+
static get encodingSchema(): Schema {
|
|
5311
|
+
if (!this.encodingSchemaValue) {
|
|
5312
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
5313
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
5314
|
+
{
|
|
5315
|
+
key: 'address',
|
|
5316
|
+
valueSchema: new OptionalSchema(new StringSchema()),
|
|
5317
|
+
omitEmpty: true,
|
|
5318
|
+
},
|
|
5319
|
+
{
|
|
5320
|
+
key: 'application-id',
|
|
5321
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
5322
|
+
omitEmpty: true,
|
|
5323
|
+
},
|
|
5324
|
+
{
|
|
5325
|
+
key: 'asset-id',
|
|
5326
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
5327
|
+
omitEmpty: true,
|
|
5328
|
+
},
|
|
5329
|
+
{
|
|
5330
|
+
key: 'box',
|
|
5331
|
+
valueSchema: new OptionalSchema(BoxReference.encodingSchema),
|
|
5332
|
+
omitEmpty: true,
|
|
5333
|
+
},
|
|
5334
|
+
{
|
|
5335
|
+
key: 'holding',
|
|
5336
|
+
valueSchema: new OptionalSchema(HoldingRef.encodingSchema),
|
|
5337
|
+
omitEmpty: true,
|
|
5338
|
+
},
|
|
5339
|
+
{
|
|
5340
|
+
key: 'local',
|
|
5341
|
+
valueSchema: new OptionalSchema(LocalsRef.encodingSchema),
|
|
5342
|
+
omitEmpty: true,
|
|
5343
|
+
}
|
|
5344
|
+
);
|
|
5345
|
+
}
|
|
5346
|
+
return this.encodingSchemaValue;
|
|
5347
|
+
}
|
|
5348
|
+
|
|
5349
|
+
/**
|
|
5350
|
+
* (d) Account whose balance record is accessible by the executing ApprovalProgram
|
|
5351
|
+
* or ClearStateProgram.
|
|
5352
|
+
*/
|
|
5353
|
+
public address?: Address;
|
|
5354
|
+
|
|
5355
|
+
/**
|
|
5356
|
+
* (p) Application id whose GlobalState may be read by the executing
|
|
5357
|
+
* ApprovalProgram or ClearStateProgram.
|
|
5358
|
+
*/
|
|
5359
|
+
public applicationId?: number;
|
|
5360
|
+
|
|
5361
|
+
/**
|
|
5362
|
+
* (s) Asset whose AssetParams may be read by the executing
|
|
5363
|
+
* ApprovalProgram or ClearStateProgram.
|
|
5364
|
+
*/
|
|
5365
|
+
public assetId?: number;
|
|
5366
|
+
|
|
5367
|
+
/**
|
|
5368
|
+
* BoxReference names a box by its name and the application ID it belongs to.
|
|
5369
|
+
*/
|
|
5370
|
+
public box?: BoxReference;
|
|
5371
|
+
|
|
5372
|
+
/**
|
|
5373
|
+
* HoldingRef names a holding by referring to an Address and Asset it belongs to.
|
|
5374
|
+
*/
|
|
5375
|
+
public holding?: HoldingRef;
|
|
5376
|
+
|
|
5377
|
+
/**
|
|
5378
|
+
* LocalsRef names a local state by referring to an Address and App it belongs to.
|
|
5379
|
+
*/
|
|
5380
|
+
public local?: LocalsRef;
|
|
5381
|
+
|
|
5382
|
+
/**
|
|
5383
|
+
* Creates a new `ResourceRef` object.
|
|
5384
|
+
* @param address - (d) Account whose balance record is accessible by the executing ApprovalProgram
|
|
5385
|
+
* or ClearStateProgram.
|
|
5386
|
+
* @param applicationId - (p) Application id whose GlobalState may be read by the executing
|
|
5387
|
+
* ApprovalProgram or ClearStateProgram.
|
|
5388
|
+
* @param assetId - (s) Asset whose AssetParams may be read by the executing
|
|
5389
|
+
* ApprovalProgram or ClearStateProgram.
|
|
5390
|
+
* @param box - BoxReference names a box by its name and the application ID it belongs to.
|
|
5391
|
+
* @param holding - HoldingRef names a holding by referring to an Address and Asset it belongs to.
|
|
5392
|
+
* @param local - LocalsRef names a local state by referring to an Address and App it belongs to.
|
|
5393
|
+
*/
|
|
5394
|
+
constructor({
|
|
5395
|
+
address,
|
|
5396
|
+
applicationId,
|
|
5397
|
+
assetId,
|
|
5398
|
+
box,
|
|
5399
|
+
holding,
|
|
5400
|
+
local,
|
|
5401
|
+
}: {
|
|
5402
|
+
address?: Address | string;
|
|
5403
|
+
applicationId?: number | bigint;
|
|
5404
|
+
assetId?: number | bigint;
|
|
5405
|
+
box?: BoxReference;
|
|
5406
|
+
holding?: HoldingRef;
|
|
5407
|
+
local?: LocalsRef;
|
|
5408
|
+
}) {
|
|
5409
|
+
this.address =
|
|
5410
|
+
typeof address === 'string' ? Address.fromString(address) : address;
|
|
5411
|
+
this.applicationId =
|
|
5412
|
+
typeof applicationId === 'undefined'
|
|
5413
|
+
? undefined
|
|
5414
|
+
: ensureSafeInteger(applicationId);
|
|
5415
|
+
this.assetId =
|
|
5416
|
+
typeof assetId === 'undefined' ? undefined : ensureSafeInteger(assetId);
|
|
5417
|
+
this.box = box;
|
|
5418
|
+
this.holding = holding;
|
|
5419
|
+
this.local = local;
|
|
5420
|
+
}
|
|
5421
|
+
|
|
5422
|
+
// eslint-disable-next-line class-methods-use-this
|
|
5423
|
+
getEncodingSchema(): Schema {
|
|
5424
|
+
return ResourceRef.encodingSchema;
|
|
5425
|
+
}
|
|
5426
|
+
|
|
5427
|
+
toEncodingData(): Map<string, unknown> {
|
|
5428
|
+
return new Map<string, unknown>([
|
|
5429
|
+
[
|
|
5430
|
+
'address',
|
|
5431
|
+
typeof this.address !== 'undefined'
|
|
5432
|
+
? this.address.toString()
|
|
5433
|
+
: undefined,
|
|
5434
|
+
],
|
|
5435
|
+
['application-id', this.applicationId],
|
|
5436
|
+
['asset-id', this.assetId],
|
|
5437
|
+
[
|
|
5438
|
+
'box',
|
|
5439
|
+
typeof this.box !== 'undefined' ? this.box.toEncodingData() : undefined,
|
|
5440
|
+
],
|
|
5441
|
+
[
|
|
5442
|
+
'holding',
|
|
5443
|
+
typeof this.holding !== 'undefined'
|
|
5444
|
+
? this.holding.toEncodingData()
|
|
5445
|
+
: undefined,
|
|
5446
|
+
],
|
|
5447
|
+
[
|
|
5448
|
+
'local',
|
|
5449
|
+
typeof this.local !== 'undefined'
|
|
5450
|
+
? this.local.toEncodingData()
|
|
5451
|
+
: undefined,
|
|
5452
|
+
],
|
|
5453
|
+
]);
|
|
5454
|
+
}
|
|
5455
|
+
|
|
5456
|
+
static fromEncodingData(data: unknown): ResourceRef {
|
|
5457
|
+
if (!(data instanceof Map)) {
|
|
5458
|
+
throw new Error(`Invalid decoded ResourceRef: ${data}`);
|
|
5459
|
+
}
|
|
5460
|
+
return new ResourceRef({
|
|
5461
|
+
address: data.get('address'),
|
|
5462
|
+
applicationId: data.get('application-id'),
|
|
5463
|
+
assetId: data.get('asset-id'),
|
|
5464
|
+
box:
|
|
5465
|
+
typeof data.get('box') !== 'undefined'
|
|
5466
|
+
? BoxReference.fromEncodingData(data.get('box'))
|
|
5467
|
+
: undefined,
|
|
5468
|
+
holding:
|
|
5469
|
+
typeof data.get('holding') !== 'undefined'
|
|
5470
|
+
? HoldingRef.fromEncodingData(data.get('holding'))
|
|
5471
|
+
: undefined,
|
|
5472
|
+
local:
|
|
5473
|
+
typeof data.get('local') !== 'undefined'
|
|
5474
|
+
? LocalsRef.fromEncodingData(data.get('local'))
|
|
5475
|
+
: undefined,
|
|
5476
|
+
});
|
|
5477
|
+
}
|
|
5478
|
+
}
|
|
5479
|
+
|
|
5126
5480
|
/**
|
|
5127
5481
|
* (sp) represents a state proof.
|
|
5128
5482
|
* Definition:
|
|
@@ -6960,6 +7314,13 @@ export class TransactionApplication implements Encodable {
|
|
|
6960
7314
|
valueSchema: new Uint64Schema(),
|
|
6961
7315
|
omitEmpty: true,
|
|
6962
7316
|
},
|
|
7317
|
+
{
|
|
7318
|
+
key: 'access',
|
|
7319
|
+
valueSchema: new OptionalSchema(
|
|
7320
|
+
new ArraySchema(ResourceRef.encodingSchema)
|
|
7321
|
+
),
|
|
7322
|
+
omitEmpty: true,
|
|
7323
|
+
},
|
|
6963
7324
|
{
|
|
6964
7325
|
key: 'accounts',
|
|
6965
7326
|
valueSchema: new OptionalSchema(new ArraySchema(new StringSchema())),
|
|
@@ -7034,6 +7395,13 @@ export class TransactionApplication implements Encodable {
|
|
|
7034
7395
|
*/
|
|
7035
7396
|
public applicationId: bigint;
|
|
7036
7397
|
|
|
7398
|
+
/**
|
|
7399
|
+
* (al) Access unifies `accounts`, `foreign-apps`, `foreign-assets`, and
|
|
7400
|
+
* `box-references` under a single list. If access is non-empty, these lists must
|
|
7401
|
+
* be empty. If access is empty, those lists may be non-empty.
|
|
7402
|
+
*/
|
|
7403
|
+
public access?: ResourceRef[];
|
|
7404
|
+
|
|
7037
7405
|
/**
|
|
7038
7406
|
* (apat) List of accounts in addition to the sender that may be accessed from the
|
|
7039
7407
|
* application's approval-program and clear-state-program.
|
|
@@ -7124,6 +7492,9 @@ export class TransactionApplication implements Encodable {
|
|
|
7124
7492
|
/**
|
|
7125
7493
|
* Creates a new `TransactionApplication` object.
|
|
7126
7494
|
* @param applicationId - (apid) ID of the application being configured or empty if creating.
|
|
7495
|
+
* @param access - (al) Access unifies `accounts`, `foreign-apps`, `foreign-assets`, and
|
|
7496
|
+
* `box-references` under a single list. If access is non-empty, these lists must
|
|
7497
|
+
* be empty. If access is empty, those lists may be non-empty.
|
|
7127
7498
|
* @param accounts - (apat) List of accounts in addition to the sender that may be accessed from the
|
|
7128
7499
|
* application's approval-program and clear-state-program.
|
|
7129
7500
|
* @param applicationArgs - (apaa) transaction specific arguments accessed from the application's
|
|
@@ -7166,6 +7537,7 @@ export class TransactionApplication implements Encodable {
|
|
|
7166
7537
|
*/
|
|
7167
7538
|
constructor({
|
|
7168
7539
|
applicationId,
|
|
7540
|
+
access,
|
|
7169
7541
|
accounts,
|
|
7170
7542
|
applicationArgs,
|
|
7171
7543
|
approvalProgram,
|
|
@@ -7180,6 +7552,7 @@ export class TransactionApplication implements Encodable {
|
|
|
7180
7552
|
rejectVersion,
|
|
7181
7553
|
}: {
|
|
7182
7554
|
applicationId: number | bigint;
|
|
7555
|
+
access?: ResourceRef[];
|
|
7183
7556
|
accounts?: (Address | string)[];
|
|
7184
7557
|
applicationArgs?: Uint8Array[];
|
|
7185
7558
|
approvalProgram?: string | Uint8Array;
|
|
@@ -7194,6 +7567,7 @@ export class TransactionApplication implements Encodable {
|
|
|
7194
7567
|
rejectVersion?: number | bigint;
|
|
7195
7568
|
}) {
|
|
7196
7569
|
this.applicationId = ensureBigInt(applicationId);
|
|
7570
|
+
this.access = access;
|
|
7197
7571
|
this.accounts =
|
|
7198
7572
|
typeof accounts !== 'undefined'
|
|
7199
7573
|
? accounts.map((addr) =>
|
|
@@ -7239,6 +7613,12 @@ export class TransactionApplication implements Encodable {
|
|
|
7239
7613
|
toEncodingData(): Map<string, unknown> {
|
|
7240
7614
|
return new Map<string, unknown>([
|
|
7241
7615
|
['application-id', this.applicationId],
|
|
7616
|
+
[
|
|
7617
|
+
'access',
|
|
7618
|
+
typeof this.access !== 'undefined'
|
|
7619
|
+
? this.access.map((v) => v.toEncodingData())
|
|
7620
|
+
: undefined,
|
|
7621
|
+
],
|
|
7242
7622
|
[
|
|
7243
7623
|
'accounts',
|
|
7244
7624
|
typeof this.accounts !== 'undefined'
|
|
@@ -7280,6 +7660,12 @@ export class TransactionApplication implements Encodable {
|
|
|
7280
7660
|
}
|
|
7281
7661
|
return new TransactionApplication({
|
|
7282
7662
|
applicationId: data.get('application-id'),
|
|
7663
|
+
access:
|
|
7664
|
+
typeof data.get('access') !== 'undefined'
|
|
7665
|
+
? data
|
|
7666
|
+
.get('access')
|
|
7667
|
+
.map((v: unknown) => ResourceRef.fromEncodingData(v))
|
|
7668
|
+
: undefined,
|
|
7283
7669
|
accounts: data.get('accounts'),
|
|
7284
7670
|
applicationArgs: data.get('application-args'),
|
|
7285
7671
|
approvalProgram: data.get('approval-program'),
|
|
@@ -8158,7 +8544,7 @@ export class TransactionSignature implements Encodable {
|
|
|
8158
8544
|
public logicsig?: TransactionSignatureLogicsig;
|
|
8159
8545
|
|
|
8160
8546
|
/**
|
|
8161
|
-
*
|
|
8547
|
+
* structure holding multiple subsignatures.
|
|
8162
8548
|
* Definition:
|
|
8163
8549
|
* crypto/multisig.go : MultisigSig
|
|
8164
8550
|
*/
|
|
@@ -8174,7 +8560,7 @@ export class TransactionSignature implements Encodable {
|
|
|
8174
8560
|
* @param logicsig - (lsig) Programatic transaction signature.
|
|
8175
8561
|
* Definition:
|
|
8176
8562
|
* data/transactions/logicsig.go
|
|
8177
|
-
* @param multisig -
|
|
8563
|
+
* @param multisig - structure holding multiple subsignatures.
|
|
8178
8564
|
* Definition:
|
|
8179
8565
|
* crypto/multisig.go : MultisigSig
|
|
8180
8566
|
* @param sig - (sig) Standard ed25519 signature.
|
|
@@ -8254,6 +8640,13 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8254
8640
|
),
|
|
8255
8641
|
omitEmpty: true,
|
|
8256
8642
|
},
|
|
8643
|
+
{
|
|
8644
|
+
key: 'logic-multisig-signature',
|
|
8645
|
+
valueSchema: new OptionalSchema(
|
|
8646
|
+
TransactionSignatureMultisig.encodingSchema
|
|
8647
|
+
),
|
|
8648
|
+
omitEmpty: true,
|
|
8649
|
+
},
|
|
8257
8650
|
{
|
|
8258
8651
|
key: 'multisig-signature',
|
|
8259
8652
|
valueSchema: new OptionalSchema(
|
|
@@ -8283,7 +8676,14 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8283
8676
|
public args?: Uint8Array[];
|
|
8284
8677
|
|
|
8285
8678
|
/**
|
|
8286
|
-
*
|
|
8679
|
+
* structure holding multiple subsignatures.
|
|
8680
|
+
* Definition:
|
|
8681
|
+
* crypto/multisig.go : MultisigSig
|
|
8682
|
+
*/
|
|
8683
|
+
public logicMultisigSignature?: TransactionSignatureMultisig;
|
|
8684
|
+
|
|
8685
|
+
/**
|
|
8686
|
+
* structure holding multiple subsignatures.
|
|
8287
8687
|
* Definition:
|
|
8288
8688
|
* crypto/multisig.go : MultisigSig
|
|
8289
8689
|
*/
|
|
@@ -8299,7 +8699,10 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8299
8699
|
* @param logic - (l) Program signed by a signature or multi signature, or hashed to be the
|
|
8300
8700
|
* address of ana ccount. Base64 encoded TEAL program.
|
|
8301
8701
|
* @param args - (arg) Logic arguments, base64 encoded.
|
|
8302
|
-
* @param
|
|
8702
|
+
* @param logicMultisigSignature - structure holding multiple subsignatures.
|
|
8703
|
+
* Definition:
|
|
8704
|
+
* crypto/multisig.go : MultisigSig
|
|
8705
|
+
* @param multisigSignature - structure holding multiple subsignatures.
|
|
8303
8706
|
* Definition:
|
|
8304
8707
|
* crypto/multisig.go : MultisigSig
|
|
8305
8708
|
* @param signature - (sig) ed25519 signature.
|
|
@@ -8307,16 +8710,19 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8307
8710
|
constructor({
|
|
8308
8711
|
logic,
|
|
8309
8712
|
args,
|
|
8713
|
+
logicMultisigSignature,
|
|
8310
8714
|
multisigSignature,
|
|
8311
8715
|
signature,
|
|
8312
8716
|
}: {
|
|
8313
8717
|
logic: string | Uint8Array;
|
|
8314
8718
|
args?: Uint8Array[];
|
|
8719
|
+
logicMultisigSignature?: TransactionSignatureMultisig;
|
|
8315
8720
|
multisigSignature?: TransactionSignatureMultisig;
|
|
8316
8721
|
signature?: string | Uint8Array;
|
|
8317
8722
|
}) {
|
|
8318
8723
|
this.logic = typeof logic === 'string' ? base64ToBytes(logic) : logic;
|
|
8319
8724
|
this.args = args;
|
|
8725
|
+
this.logicMultisigSignature = logicMultisigSignature;
|
|
8320
8726
|
this.multisigSignature = multisigSignature;
|
|
8321
8727
|
this.signature =
|
|
8322
8728
|
typeof signature === 'string' ? base64ToBytes(signature) : signature;
|
|
@@ -8331,6 +8737,12 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8331
8737
|
return new Map<string, unknown>([
|
|
8332
8738
|
['logic', this.logic],
|
|
8333
8739
|
['args', this.args],
|
|
8740
|
+
[
|
|
8741
|
+
'logic-multisig-signature',
|
|
8742
|
+
typeof this.logicMultisigSignature !== 'undefined'
|
|
8743
|
+
? this.logicMultisigSignature.toEncodingData()
|
|
8744
|
+
: undefined,
|
|
8745
|
+
],
|
|
8334
8746
|
[
|
|
8335
8747
|
'multisig-signature',
|
|
8336
8748
|
typeof this.multisigSignature !== 'undefined'
|
|
@@ -8348,6 +8760,12 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8348
8760
|
return new TransactionSignatureLogicsig({
|
|
8349
8761
|
logic: data.get('logic'),
|
|
8350
8762
|
args: data.get('args'),
|
|
8763
|
+
logicMultisigSignature:
|
|
8764
|
+
typeof data.get('logic-multisig-signature') !== 'undefined'
|
|
8765
|
+
? TransactionSignatureMultisig.fromEncodingData(
|
|
8766
|
+
data.get('logic-multisig-signature')
|
|
8767
|
+
)
|
|
8768
|
+
: undefined,
|
|
8351
8769
|
multisigSignature:
|
|
8352
8770
|
typeof data.get('multisig-signature') !== 'undefined'
|
|
8353
8771
|
? TransactionSignatureMultisig.fromEncodingData(
|
|
@@ -8360,7 +8778,7 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8360
8778
|
}
|
|
8361
8779
|
|
|
8362
8780
|
/**
|
|
8363
|
-
*
|
|
8781
|
+
* structure holding multiple subsignatures.
|
|
8364
8782
|
* Definition:
|
|
8365
8783
|
* crypto/multisig.go : MultisigSig
|
|
8366
8784
|
*/
|