algosdk 3.7.0-beta.1 → 3.8.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 +4 -0
- package/dist/cjs/appAccess.js.map +1 -1
- package/dist/cjs/client/v2/algod/getPeers.js +20 -0
- package/dist/cjs/client/v2/algod/getPeers.js.map +1 -0
- package/dist/cjs/client/v2/algod/models/types.js +153 -5
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/client/v2/indexer/models/types.js +163 -12
- package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
- package/dist/cjs/composer.js +4 -6
- package/dist/cjs/composer.js.map +1 -1
- package/dist/cjs/ed25519-signer.js +18 -0
- package/dist/cjs/ed25519-signer.js.map +1 -1
- package/dist/cjs/encoding/address.js +9 -0
- package/dist/cjs/encoding/address.js.map +1 -1
- package/dist/cjs/falcon-signer.js +16 -0
- package/dist/cjs/falcon-signer.js.map +1 -1
- package/dist/cjs/heartbeat.js +7 -0
- package/dist/cjs/heartbeat.js.map +1 -1
- package/dist/cjs/logicsig.js +86 -6
- package/dist/cjs/logicsig.js.map +1 -1
- package/dist/cjs/makeTxn.js +11 -2
- package/dist/cjs/makeTxn.js.map +1 -1
- package/dist/cjs/mnemonic/mnemonic.js +2 -0
- package/dist/cjs/mnemonic/mnemonic.js.map +1 -1
- package/dist/cjs/pq-signer.js +51 -0
- package/dist/cjs/pq-signer.js.map +1 -1
- package/dist/cjs/signer.js.map +1 -1
- package/dist/cjs/signing.js +22 -0
- package/dist/cjs/signing.js.map +1 -1
- package/dist/cjs/transaction.js +8 -0
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/cjs/types/block.js +28 -0
- package/dist/cjs/types/block.js.map +1 -1
- package/dist/cjs/types/statedelta.js +17 -0
- package/dist/cjs/types/statedelta.js.map +1 -1
- package/dist/cjs/utils/utils.js +14 -1
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/esm/appAccess.js +4 -0
- package/dist/esm/appAccess.js.map +1 -1
- package/dist/esm/client/v2/algod/getPeers.js +14 -0
- package/dist/esm/client/v2/algod/getPeers.js.map +1 -0
- package/dist/esm/client/v2/algod/models/types.js +149 -3
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/client/v2/indexer/models/types.js +161 -11
- package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
- package/dist/esm/composer.js +4 -6
- package/dist/esm/composer.js.map +1 -1
- package/dist/esm/ed25519-signer.js +18 -0
- package/dist/esm/ed25519-signer.js.map +1 -1
- package/dist/esm/encoding/address.js +9 -0
- package/dist/esm/encoding/address.js.map +1 -1
- package/dist/esm/falcon-signer.js +16 -0
- package/dist/esm/falcon-signer.js.map +1 -1
- package/dist/esm/heartbeat.js +8 -1
- package/dist/esm/heartbeat.js.map +1 -1
- package/dist/esm/logicsig.js +86 -6
- package/dist/esm/logicsig.js.map +1 -1
- package/dist/esm/makeTxn.js +11 -2
- package/dist/esm/makeTxn.js.map +1 -1
- package/dist/esm/mnemonic/mnemonic.js +2 -0
- package/dist/esm/mnemonic/mnemonic.js.map +1 -1
- package/dist/esm/pq-signer.js +51 -0
- package/dist/esm/pq-signer.js.map +1 -1
- package/dist/esm/signer.js.map +1 -1
- package/dist/esm/signing.js +22 -0
- package/dist/esm/signing.js.map +1 -1
- package/dist/esm/transaction.js +8 -0
- package/dist/esm/transaction.js.map +1 -1
- package/dist/esm/types/block.js +28 -0
- package/dist/esm/types/block.js.map +1 -1
- package/dist/esm/types/statedelta.js +17 -0
- package/dist/esm/types/statedelta.js.map +1 -1
- package/dist/esm/utils/utils.js +12 -0
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/types/client/v2/algod/getPeers.d.ts +7 -0
- package/dist/types/client/v2/algod/models/types.d.ts +90 -3
- package/dist/types/client/v2/indexer/models/types.d.ts +114 -7
- package/dist/types/composer.d.ts +3 -3
- package/dist/types/ed25519-signer.d.ts +29 -0
- package/dist/types/encoding/address.d.ts +9 -0
- package/dist/types/falcon-signer.d.ts +29 -2
- package/dist/types/heartbeat.d.ts +2 -0
- package/dist/types/logicsig.d.ts +91 -6
- package/dist/types/makeTxn.d.ts +8 -2
- package/dist/types/mnemonic/mnemonic.d.ts +2 -0
- package/dist/types/pq-signer.d.ts +39 -2
- package/dist/types/signer.d.ts +76 -5
- package/dist/types/signing.d.ts +22 -0
- package/dist/types/transaction.d.ts +1 -0
- package/dist/types/types/block.d.ts +22 -0
- package/dist/types/types/statedelta.d.ts +18 -0
- package/dist/types/types/transactions/base.d.ts +10 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +2 -2
- package/src/appAccess.ts +5 -0
- package/src/client/v2/algod/models/types.ts +234 -0
- package/src/client/v2/indexer/models/types.ts +280 -8
- package/src/composer.ts +7 -11
- package/src/ed25519-signer.ts +29 -0
- package/src/encoding/address.ts +9 -0
- package/src/falcon-signer.ts +31 -1
- package/src/heartbeat.ts +11 -0
- package/src/logicsig.ts +93 -6
- package/src/makeTxn.ts +13 -4
- package/src/mnemonic/mnemonic.ts +2 -0
- package/src/pq-signer.ts +71 -1
- package/src/signer.ts +77 -5
- package/src/signing.ts +22 -0
- package/src/transaction.ts +10 -0
- package/src/types/block.ts +54 -0
- package/src/types/statedelta.ts +34 -0
- package/src/types/transactions/base.ts +11 -0
- package/src/utils/utils.ts +13 -0
|
@@ -346,6 +346,7 @@ export class Account implements Encodable {
|
|
|
346
346
|
* * sig
|
|
347
347
|
* * msig
|
|
348
348
|
* * lsig
|
|
349
|
+
* * pqsig
|
|
349
350
|
* * or null if unknown
|
|
350
351
|
*/
|
|
351
352
|
public sigType?: string;
|
|
@@ -406,6 +407,7 @@ export class Account implements Encodable {
|
|
|
406
407
|
* * sig
|
|
407
408
|
* * msig
|
|
408
409
|
* * lsig
|
|
410
|
+
* * pqsig
|
|
409
411
|
* * or null if unknown
|
|
410
412
|
*/
|
|
411
413
|
constructor({
|
|
@@ -3026,11 +3028,21 @@ export class Block implements Encodable {
|
|
|
3026
3028
|
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
3027
3029
|
omitEmpty: true,
|
|
3028
3030
|
},
|
|
3031
|
+
{
|
|
3032
|
+
key: 'congestion-tax',
|
|
3033
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
3034
|
+
omitEmpty: true,
|
|
3035
|
+
},
|
|
3029
3036
|
{
|
|
3030
3037
|
key: 'fees-collected',
|
|
3031
3038
|
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
3032
3039
|
omitEmpty: true,
|
|
3033
3040
|
},
|
|
3041
|
+
{
|
|
3042
|
+
key: 'load',
|
|
3043
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
3044
|
+
omitEmpty: true,
|
|
3045
|
+
},
|
|
3034
3046
|
{
|
|
3035
3047
|
key: 'participation-updates',
|
|
3036
3048
|
valueSchema: new OptionalSchema(ParticipationUpdates.encodingSchema),
|
|
@@ -3148,11 +3160,24 @@ export class Block implements Encodable {
|
|
|
3148
3160
|
*/
|
|
3149
3161
|
public bonus?: number;
|
|
3150
3162
|
|
|
3163
|
+
/**
|
|
3164
|
+
* the fee required, beyond the minimum fee, for "normal" transactions in this
|
|
3165
|
+
* block.
|
|
3166
|
+
*/
|
|
3167
|
+
public congestionTax?: number;
|
|
3168
|
+
|
|
3151
3169
|
/**
|
|
3152
3170
|
* the sum of all fees paid by transactions in this block.
|
|
3153
3171
|
*/
|
|
3154
3172
|
public feesCollected?: number;
|
|
3155
3173
|
|
|
3174
|
+
/**
|
|
3175
|
+
* the degree to which this block is full, based on the number of bytes in the
|
|
3176
|
+
* final block compared to the maximum allowed. Expressed as a fixed-point integer
|
|
3177
|
+
* with 6 digits of precision, so 1,000,000 is a completely full block.
|
|
3178
|
+
*/
|
|
3179
|
+
public load?: number;
|
|
3180
|
+
|
|
3156
3181
|
/**
|
|
3157
3182
|
* Participation account data that needs to be checked/acted on by the network.
|
|
3158
3183
|
*/
|
|
@@ -3233,7 +3258,12 @@ export class Block implements Encodable {
|
|
|
3233
3258
|
* the default SHA512_256. This commitment can be used on environments where only
|
|
3234
3259
|
* the SHA256 function exists.
|
|
3235
3260
|
* @param bonus - the potential bonus payout for this block.
|
|
3261
|
+
* @param congestionTax - the fee required, beyond the minimum fee, for "normal" transactions in this
|
|
3262
|
+
* block.
|
|
3236
3263
|
* @param feesCollected - the sum of all fees paid by transactions in this block.
|
|
3264
|
+
* @param load - the degree to which this block is full, based on the number of bytes in the
|
|
3265
|
+
* final block compared to the maximum allowed. Expressed as a fixed-point integer
|
|
3266
|
+
* with 6 digits of precision, so 1,000,000 is a completely full block.
|
|
3237
3267
|
* @param participationUpdates - Participation account data that needs to be checked/acted on by the network.
|
|
3238
3268
|
* @param previousBlockHash512 - (prev512) Previous block hash, using SHA-512.
|
|
3239
3269
|
* @param proposer - the proposer of this block.
|
|
@@ -3262,7 +3292,9 @@ export class Block implements Encodable {
|
|
|
3262
3292
|
transactionsRoot,
|
|
3263
3293
|
transactionsRootSha256,
|
|
3264
3294
|
bonus,
|
|
3295
|
+
congestionTax,
|
|
3265
3296
|
feesCollected,
|
|
3297
|
+
load,
|
|
3266
3298
|
participationUpdates,
|
|
3267
3299
|
previousBlockHash512,
|
|
3268
3300
|
proposer,
|
|
@@ -3284,7 +3316,9 @@ export class Block implements Encodable {
|
|
|
3284
3316
|
transactionsRoot: string | Uint8Array;
|
|
3285
3317
|
transactionsRootSha256: string | Uint8Array;
|
|
3286
3318
|
bonus?: number | bigint;
|
|
3319
|
+
congestionTax?: number | bigint;
|
|
3287
3320
|
feesCollected?: number | bigint;
|
|
3321
|
+
load?: number | bigint;
|
|
3288
3322
|
participationUpdates?: ParticipationUpdates;
|
|
3289
3323
|
previousBlockHash512?: string | Uint8Array;
|
|
3290
3324
|
proposer?: Address | string;
|
|
@@ -3319,10 +3353,16 @@ export class Block implements Encodable {
|
|
|
3319
3353
|
: transactionsRootSha256;
|
|
3320
3354
|
this.bonus =
|
|
3321
3355
|
typeof bonus === 'undefined' ? undefined : ensureSafeInteger(bonus);
|
|
3356
|
+
this.congestionTax =
|
|
3357
|
+
typeof congestionTax === 'undefined'
|
|
3358
|
+
? undefined
|
|
3359
|
+
: ensureSafeInteger(congestionTax);
|
|
3322
3360
|
this.feesCollected =
|
|
3323
3361
|
typeof feesCollected === 'undefined'
|
|
3324
3362
|
? undefined
|
|
3325
3363
|
: ensureSafeInteger(feesCollected);
|
|
3364
|
+
this.load =
|
|
3365
|
+
typeof load === 'undefined' ? undefined : ensureSafeInteger(load);
|
|
3326
3366
|
this.participationUpdates = participationUpdates;
|
|
3327
3367
|
this.previousBlockHash512 =
|
|
3328
3368
|
typeof previousBlockHash512 === 'string'
|
|
@@ -3365,7 +3405,9 @@ export class Block implements Encodable {
|
|
|
3365
3405
|
['transactions-root', this.transactionsRoot],
|
|
3366
3406
|
['transactions-root-sha256', this.transactionsRootSha256],
|
|
3367
3407
|
['bonus', this.bonus],
|
|
3408
|
+
['congestion-tax', this.congestionTax],
|
|
3368
3409
|
['fees-collected', this.feesCollected],
|
|
3410
|
+
['load', this.load],
|
|
3369
3411
|
[
|
|
3370
3412
|
'participation-updates',
|
|
3371
3413
|
typeof this.participationUpdates !== 'undefined'
|
|
@@ -3429,7 +3471,9 @@ export class Block implements Encodable {
|
|
|
3429
3471
|
transactionsRoot: data.get('transactions-root'),
|
|
3430
3472
|
transactionsRootSha256: data.get('transactions-root-sha256'),
|
|
3431
3473
|
bonus: data.get('bonus'),
|
|
3474
|
+
congestionTax: data.get('congestion-tax'),
|
|
3432
3475
|
feesCollected: data.get('fees-collected'),
|
|
3476
|
+
load: data.get('load'),
|
|
3433
3477
|
participationUpdates:
|
|
3434
3478
|
typeof data.get('participation-updates') !== 'undefined'
|
|
3435
3479
|
? ParticipationUpdates.fromEncodingData(
|
|
@@ -4009,7 +4053,7 @@ export class Box implements Encodable {
|
|
|
4009
4053
|
}
|
|
4010
4054
|
|
|
4011
4055
|
/**
|
|
4012
|
-
* Box descriptor describes an app box
|
|
4056
|
+
* Box descriptor describes an app box.
|
|
4013
4057
|
*/
|
|
4014
4058
|
export class BoxDescriptor implements Encodable {
|
|
4015
4059
|
private static encodingSchemaValue: Schema | undefined;
|
|
@@ -4017,11 +4061,14 @@ export class BoxDescriptor implements Encodable {
|
|
|
4017
4061
|
static get encodingSchema(): Schema {
|
|
4018
4062
|
if (!this.encodingSchemaValue) {
|
|
4019
4063
|
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4020
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4021
|
-
key: 'name',
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4064
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4065
|
+
{ key: 'name', valueSchema: new ByteArraySchema(), omitEmpty: true },
|
|
4066
|
+
{
|
|
4067
|
+
key: 'value',
|
|
4068
|
+
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
4069
|
+
omitEmpty: true,
|
|
4070
|
+
}
|
|
4071
|
+
);
|
|
4025
4072
|
}
|
|
4026
4073
|
return this.encodingSchemaValue;
|
|
4027
4074
|
}
|
|
@@ -4031,12 +4078,27 @@ export class BoxDescriptor implements Encodable {
|
|
|
4031
4078
|
*/
|
|
4032
4079
|
public name: Uint8Array;
|
|
4033
4080
|
|
|
4081
|
+
/**
|
|
4082
|
+
* Base64 encoded box value. Present only when the `values` query parameter is set
|
|
4083
|
+
* to true.
|
|
4084
|
+
*/
|
|
4085
|
+
public value?: Uint8Array;
|
|
4086
|
+
|
|
4034
4087
|
/**
|
|
4035
4088
|
* Creates a new `BoxDescriptor` object.
|
|
4036
4089
|
* @param name - Base64 encoded box name
|
|
4090
|
+
* @param value - Base64 encoded box value. Present only when the `values` query parameter is set
|
|
4091
|
+
* to true.
|
|
4037
4092
|
*/
|
|
4038
|
-
constructor({
|
|
4093
|
+
constructor({
|
|
4094
|
+
name,
|
|
4095
|
+
value,
|
|
4096
|
+
}: {
|
|
4097
|
+
name: string | Uint8Array;
|
|
4098
|
+
value?: string | Uint8Array;
|
|
4099
|
+
}) {
|
|
4039
4100
|
this.name = typeof name === 'string' ? base64ToBytes(name) : name;
|
|
4101
|
+
this.value = typeof value === 'string' ? base64ToBytes(value) : value;
|
|
4040
4102
|
}
|
|
4041
4103
|
|
|
4042
4104
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -4045,7 +4107,10 @@ export class BoxDescriptor implements Encodable {
|
|
|
4045
4107
|
}
|
|
4046
4108
|
|
|
4047
4109
|
toEncodingData(): Map<string, unknown> {
|
|
4048
|
-
return new Map<string, unknown>([
|
|
4110
|
+
return new Map<string, unknown>([
|
|
4111
|
+
['name', this.name],
|
|
4112
|
+
['value', this.value],
|
|
4113
|
+
]);
|
|
4049
4114
|
}
|
|
4050
4115
|
|
|
4051
4116
|
static fromEncodingData(data: unknown): BoxDescriptor {
|
|
@@ -4054,6 +4119,7 @@ export class BoxDescriptor implements Encodable {
|
|
|
4054
4119
|
}
|
|
4055
4120
|
return new BoxDescriptor({
|
|
4056
4121
|
name: data.get('name'),
|
|
4122
|
+
value: data.get('value'),
|
|
4057
4123
|
});
|
|
4058
4124
|
}
|
|
4059
4125
|
}
|
|
@@ -4150,6 +4216,11 @@ export class BoxesResponse implements Encodable {
|
|
|
4150
4216
|
key: 'next-token',
|
|
4151
4217
|
valueSchema: new OptionalSchema(new StringSchema()),
|
|
4152
4218
|
omitEmpty: true,
|
|
4219
|
+
},
|
|
4220
|
+
{
|
|
4221
|
+
key: 'round',
|
|
4222
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
4223
|
+
omitEmpty: true,
|
|
4153
4224
|
}
|
|
4154
4225
|
);
|
|
4155
4226
|
}
|
|
@@ -4169,25 +4240,35 @@ export class BoxesResponse implements Encodable {
|
|
|
4169
4240
|
*/
|
|
4170
4241
|
public nextToken?: string;
|
|
4171
4242
|
|
|
4243
|
+
/**
|
|
4244
|
+
* The round for which this information is relevant.
|
|
4245
|
+
*/
|
|
4246
|
+
public round?: number;
|
|
4247
|
+
|
|
4172
4248
|
/**
|
|
4173
4249
|
* Creates a new `BoxesResponse` object.
|
|
4174
4250
|
* @param applicationId - (appidx) application index.
|
|
4175
4251
|
* @param boxes -
|
|
4176
4252
|
* @param nextToken - Used for pagination, when making another request provide this token with the
|
|
4177
4253
|
* next parameter.
|
|
4254
|
+
* @param round - The round for which this information is relevant.
|
|
4178
4255
|
*/
|
|
4179
4256
|
constructor({
|
|
4180
4257
|
applicationId,
|
|
4181
4258
|
boxes,
|
|
4182
4259
|
nextToken,
|
|
4260
|
+
round,
|
|
4183
4261
|
}: {
|
|
4184
4262
|
applicationId: number | bigint;
|
|
4185
4263
|
boxes: BoxDescriptor[];
|
|
4186
4264
|
nextToken?: string;
|
|
4265
|
+
round?: number | bigint;
|
|
4187
4266
|
}) {
|
|
4188
4267
|
this.applicationId = ensureBigInt(applicationId);
|
|
4189
4268
|
this.boxes = boxes;
|
|
4190
4269
|
this.nextToken = nextToken;
|
|
4270
|
+
this.round =
|
|
4271
|
+
typeof round === 'undefined' ? undefined : ensureSafeInteger(round);
|
|
4191
4272
|
}
|
|
4192
4273
|
|
|
4193
4274
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -4200,6 +4281,7 @@ export class BoxesResponse implements Encodable {
|
|
|
4200
4281
|
['application-id', this.applicationId],
|
|
4201
4282
|
['boxes', this.boxes.map((v) => v.toEncodingData())],
|
|
4202
4283
|
['next-token', this.nextToken],
|
|
4284
|
+
['round', this.round],
|
|
4203
4285
|
]);
|
|
4204
4286
|
}
|
|
4205
4287
|
|
|
@@ -4213,6 +4295,7 @@ export class BoxesResponse implements Encodable {
|
|
|
4213
4295
|
BoxDescriptor.fromEncodingData(v)
|
|
4214
4296
|
),
|
|
4215
4297
|
nextToken: data.get('next-token'),
|
|
4298
|
+
round: data.get('round'),
|
|
4216
4299
|
});
|
|
4217
4300
|
}
|
|
4218
4301
|
}
|
|
@@ -8039,6 +8122,11 @@ export class TransactionHeartbeat implements Encodable {
|
|
|
8039
8122
|
key: 'hb-vote-id',
|
|
8040
8123
|
valueSchema: new ByteArraySchema(),
|
|
8041
8124
|
omitEmpty: true,
|
|
8125
|
+
},
|
|
8126
|
+
{
|
|
8127
|
+
key: 'hb-challenge-discount',
|
|
8128
|
+
valueSchema: new OptionalSchema(new BooleanSchema()),
|
|
8129
|
+
omitEmpty: true,
|
|
8042
8130
|
}
|
|
8043
8131
|
);
|
|
8044
8132
|
}
|
|
@@ -8072,6 +8160,13 @@ export class TransactionHeartbeat implements Encodable {
|
|
|
8072
8160
|
*/
|
|
8073
8161
|
public hbVoteId: Uint8Array;
|
|
8074
8162
|
|
|
8163
|
+
/**
|
|
8164
|
+
* (hbc) HbChallengeDiscount requests the challenge fee discount, reducing the
|
|
8165
|
+
* required fee by one min fee. It is a request, not an assertion: it is granted
|
|
8166
|
+
* only if HbAddress is actually under challenge.
|
|
8167
|
+
*/
|
|
8168
|
+
public hbChallengeDiscount?: boolean;
|
|
8169
|
+
|
|
8075
8170
|
/**
|
|
8076
8171
|
* Creates a new `TransactionHeartbeat` object.
|
|
8077
8172
|
* @param hbAddress - (hbad) HbAddress is the account this txn is proving onlineness for.
|
|
@@ -8081,6 +8176,9 @@ export class TransactionHeartbeat implements Encodable {
|
|
|
8081
8176
|
* @param hbSeed - (hbsd) HbSeed must be the block seed for the this transaction's firstValid
|
|
8082
8177
|
* block.
|
|
8083
8178
|
* @param hbVoteId - (hbvid) HbVoteID must match the HbAddress account's current VoteID.
|
|
8179
|
+
* @param hbChallengeDiscount - (hbc) HbChallengeDiscount requests the challenge fee discount, reducing the
|
|
8180
|
+
* required fee by one min fee. It is a request, not an assertion: it is granted
|
|
8181
|
+
* only if HbAddress is actually under challenge.
|
|
8084
8182
|
*/
|
|
8085
8183
|
constructor({
|
|
8086
8184
|
hbAddress,
|
|
@@ -8088,12 +8186,14 @@ export class TransactionHeartbeat implements Encodable {
|
|
|
8088
8186
|
hbProof,
|
|
8089
8187
|
hbSeed,
|
|
8090
8188
|
hbVoteId,
|
|
8189
|
+
hbChallengeDiscount,
|
|
8091
8190
|
}: {
|
|
8092
8191
|
hbAddress: string;
|
|
8093
8192
|
hbKeyDilution: number | bigint;
|
|
8094
8193
|
hbProof: HbProofFields;
|
|
8095
8194
|
hbSeed: string | Uint8Array;
|
|
8096
8195
|
hbVoteId: string | Uint8Array;
|
|
8196
|
+
hbChallengeDiscount?: boolean;
|
|
8097
8197
|
}) {
|
|
8098
8198
|
this.hbAddress = hbAddress;
|
|
8099
8199
|
this.hbKeyDilution = ensureBigInt(hbKeyDilution);
|
|
@@ -8101,6 +8201,7 @@ export class TransactionHeartbeat implements Encodable {
|
|
|
8101
8201
|
this.hbSeed = typeof hbSeed === 'string' ? base64ToBytes(hbSeed) : hbSeed;
|
|
8102
8202
|
this.hbVoteId =
|
|
8103
8203
|
typeof hbVoteId === 'string' ? base64ToBytes(hbVoteId) : hbVoteId;
|
|
8204
|
+
this.hbChallengeDiscount = hbChallengeDiscount;
|
|
8104
8205
|
}
|
|
8105
8206
|
|
|
8106
8207
|
// eslint-disable-next-line class-methods-use-this
|
|
@@ -8115,6 +8216,7 @@ export class TransactionHeartbeat implements Encodable {
|
|
|
8115
8216
|
['hb-proof', this.hbProof.toEncodingData()],
|
|
8116
8217
|
['hb-seed', this.hbSeed],
|
|
8117
8218
|
['hb-vote-id', this.hbVoteId],
|
|
8219
|
+
['hb-challenge-discount', this.hbChallengeDiscount],
|
|
8118
8220
|
]);
|
|
8119
8221
|
}
|
|
8120
8222
|
|
|
@@ -8130,6 +8232,7 @@ export class TransactionHeartbeat implements Encodable {
|
|
|
8130
8232
|
),
|
|
8131
8233
|
hbSeed: data.get('hb-seed'),
|
|
8132
8234
|
hbVoteId: data.get('hb-vote-id'),
|
|
8235
|
+
hbChallengeDiscount: data.get('hb-challenge-discount'),
|
|
8133
8236
|
});
|
|
8134
8237
|
}
|
|
8135
8238
|
}
|
|
@@ -8526,6 +8629,13 @@ export class TransactionSignature implements Encodable {
|
|
|
8526
8629
|
),
|
|
8527
8630
|
omitEmpty: true,
|
|
8528
8631
|
},
|
|
8632
|
+
{
|
|
8633
|
+
key: 'pqsig',
|
|
8634
|
+
valueSchema: new OptionalSchema(
|
|
8635
|
+
TransactionSignaturePQsig.encodingSchema
|
|
8636
|
+
),
|
|
8637
|
+
omitEmpty: true,
|
|
8638
|
+
},
|
|
8529
8639
|
{
|
|
8530
8640
|
key: 'sig',
|
|
8531
8641
|
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
@@ -8550,6 +8660,13 @@ export class TransactionSignature implements Encodable {
|
|
|
8550
8660
|
*/
|
|
8551
8661
|
public multisig?: TransactionSignatureMultisig;
|
|
8552
8662
|
|
|
8663
|
+
/**
|
|
8664
|
+
* structure holding a post-quantum signature.
|
|
8665
|
+
* Definition:
|
|
8666
|
+
* data/transactions/pqsig.go : PQSig
|
|
8667
|
+
*/
|
|
8668
|
+
public pqsig?: TransactionSignaturePQsig;
|
|
8669
|
+
|
|
8553
8670
|
/**
|
|
8554
8671
|
* (sig) Standard ed25519 signature.
|
|
8555
8672
|
*/
|
|
@@ -8563,19 +8680,25 @@ export class TransactionSignature implements Encodable {
|
|
|
8563
8680
|
* @param multisig - structure holding multiple subsignatures.
|
|
8564
8681
|
* Definition:
|
|
8565
8682
|
* crypto/multisig.go : MultisigSig
|
|
8683
|
+
* @param pqsig - structure holding a post-quantum signature.
|
|
8684
|
+
* Definition:
|
|
8685
|
+
* data/transactions/pqsig.go : PQSig
|
|
8566
8686
|
* @param sig - (sig) Standard ed25519 signature.
|
|
8567
8687
|
*/
|
|
8568
8688
|
constructor({
|
|
8569
8689
|
logicsig,
|
|
8570
8690
|
multisig,
|
|
8691
|
+
pqsig,
|
|
8571
8692
|
sig,
|
|
8572
8693
|
}: {
|
|
8573
8694
|
logicsig?: TransactionSignatureLogicsig;
|
|
8574
8695
|
multisig?: TransactionSignatureMultisig;
|
|
8696
|
+
pqsig?: TransactionSignaturePQsig;
|
|
8575
8697
|
sig?: string | Uint8Array;
|
|
8576
8698
|
}) {
|
|
8577
8699
|
this.logicsig = logicsig;
|
|
8578
8700
|
this.multisig = multisig;
|
|
8701
|
+
this.pqsig = pqsig;
|
|
8579
8702
|
this.sig = typeof sig === 'string' ? base64ToBytes(sig) : sig;
|
|
8580
8703
|
}
|
|
8581
8704
|
|
|
@@ -8598,6 +8721,12 @@ export class TransactionSignature implements Encodable {
|
|
|
8598
8721
|
? this.multisig.toEncodingData()
|
|
8599
8722
|
: undefined,
|
|
8600
8723
|
],
|
|
8724
|
+
[
|
|
8725
|
+
'pqsig',
|
|
8726
|
+
typeof this.pqsig !== 'undefined'
|
|
8727
|
+
? this.pqsig.toEncodingData()
|
|
8728
|
+
: undefined,
|
|
8729
|
+
],
|
|
8601
8730
|
['sig', this.sig],
|
|
8602
8731
|
]);
|
|
8603
8732
|
}
|
|
@@ -8615,6 +8744,10 @@ export class TransactionSignature implements Encodable {
|
|
|
8615
8744
|
typeof data.get('multisig') !== 'undefined'
|
|
8616
8745
|
? TransactionSignatureMultisig.fromEncodingData(data.get('multisig'))
|
|
8617
8746
|
: undefined,
|
|
8747
|
+
pqsig:
|
|
8748
|
+
typeof data.get('pqsig') !== 'undefined'
|
|
8749
|
+
? TransactionSignaturePQsig.fromEncodingData(data.get('pqsig'))
|
|
8750
|
+
: undefined,
|
|
8618
8751
|
sig: data.get('sig'),
|
|
8619
8752
|
});
|
|
8620
8753
|
}
|
|
@@ -8654,6 +8787,13 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8654
8787
|
),
|
|
8655
8788
|
omitEmpty: true,
|
|
8656
8789
|
},
|
|
8790
|
+
{
|
|
8791
|
+
key: 'pqsig',
|
|
8792
|
+
valueSchema: new OptionalSchema(
|
|
8793
|
+
TransactionSignaturePQsig.encodingSchema
|
|
8794
|
+
),
|
|
8795
|
+
omitEmpty: true,
|
|
8796
|
+
},
|
|
8657
8797
|
{
|
|
8658
8798
|
key: 'signature',
|
|
8659
8799
|
valueSchema: new OptionalSchema(new ByteArraySchema()),
|
|
@@ -8689,6 +8829,13 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8689
8829
|
*/
|
|
8690
8830
|
public multisigSignature?: TransactionSignatureMultisig;
|
|
8691
8831
|
|
|
8832
|
+
/**
|
|
8833
|
+
* structure holding a post-quantum signature.
|
|
8834
|
+
* Definition:
|
|
8835
|
+
* data/transactions/pqsig.go : PQSig
|
|
8836
|
+
*/
|
|
8837
|
+
public pqsig?: TransactionSignaturePQsig;
|
|
8838
|
+
|
|
8692
8839
|
/**
|
|
8693
8840
|
* (sig) ed25519 signature.
|
|
8694
8841
|
*/
|
|
@@ -8705,6 +8852,9 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8705
8852
|
* @param multisigSignature - structure holding multiple subsignatures.
|
|
8706
8853
|
* Definition:
|
|
8707
8854
|
* crypto/multisig.go : MultisigSig
|
|
8855
|
+
* @param pqsig - structure holding a post-quantum signature.
|
|
8856
|
+
* Definition:
|
|
8857
|
+
* data/transactions/pqsig.go : PQSig
|
|
8708
8858
|
* @param signature - (sig) ed25519 signature.
|
|
8709
8859
|
*/
|
|
8710
8860
|
constructor({
|
|
@@ -8712,18 +8862,21 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8712
8862
|
args,
|
|
8713
8863
|
logicMultisigSignature,
|
|
8714
8864
|
multisigSignature,
|
|
8865
|
+
pqsig,
|
|
8715
8866
|
signature,
|
|
8716
8867
|
}: {
|
|
8717
8868
|
logic: string | Uint8Array;
|
|
8718
8869
|
args?: Uint8Array[];
|
|
8719
8870
|
logicMultisigSignature?: TransactionSignatureMultisig;
|
|
8720
8871
|
multisigSignature?: TransactionSignatureMultisig;
|
|
8872
|
+
pqsig?: TransactionSignaturePQsig;
|
|
8721
8873
|
signature?: string | Uint8Array;
|
|
8722
8874
|
}) {
|
|
8723
8875
|
this.logic = typeof logic === 'string' ? base64ToBytes(logic) : logic;
|
|
8724
8876
|
this.args = args;
|
|
8725
8877
|
this.logicMultisigSignature = logicMultisigSignature;
|
|
8726
8878
|
this.multisigSignature = multisigSignature;
|
|
8879
|
+
this.pqsig = pqsig;
|
|
8727
8880
|
this.signature =
|
|
8728
8881
|
typeof signature === 'string' ? base64ToBytes(signature) : signature;
|
|
8729
8882
|
}
|
|
@@ -8749,6 +8902,12 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8749
8902
|
? this.multisigSignature.toEncodingData()
|
|
8750
8903
|
: undefined,
|
|
8751
8904
|
],
|
|
8905
|
+
[
|
|
8906
|
+
'pqsig',
|
|
8907
|
+
typeof this.pqsig !== 'undefined'
|
|
8908
|
+
? this.pqsig.toEncodingData()
|
|
8909
|
+
: undefined,
|
|
8910
|
+
],
|
|
8752
8911
|
['signature', this.signature],
|
|
8753
8912
|
]);
|
|
8754
8913
|
}
|
|
@@ -8772,6 +8931,10 @@ export class TransactionSignatureLogicsig implements Encodable {
|
|
|
8772
8931
|
data.get('multisig-signature')
|
|
8773
8932
|
)
|
|
8774
8933
|
: undefined,
|
|
8934
|
+
pqsig:
|
|
8935
|
+
typeof data.get('pqsig') !== 'undefined'
|
|
8936
|
+
? TransactionSignaturePQsig.fromEncodingData(data.get('pqsig'))
|
|
8937
|
+
: undefined,
|
|
8775
8938
|
signature: data.get('signature'),
|
|
8776
8939
|
});
|
|
8777
8940
|
}
|
|
@@ -8966,6 +9129,115 @@ export class TransactionSignatureMultisigSubsignature implements Encodable {
|
|
|
8966
9129
|
}
|
|
8967
9130
|
}
|
|
8968
9131
|
|
|
9132
|
+
/**
|
|
9133
|
+
* structure holding a post-quantum signature.
|
|
9134
|
+
* Definition:
|
|
9135
|
+
* data/transactions/pqsig.go : PQSig
|
|
9136
|
+
*/
|
|
9137
|
+
export class TransactionSignaturePQsig implements Encodable {
|
|
9138
|
+
private static encodingSchemaValue: Schema | undefined;
|
|
9139
|
+
|
|
9140
|
+
static get encodingSchema(): Schema {
|
|
9141
|
+
if (!this.encodingSchemaValue) {
|
|
9142
|
+
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
9143
|
+
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
9144
|
+
{
|
|
9145
|
+
key: 'public-key',
|
|
9146
|
+
valueSchema: new ByteArraySchema(),
|
|
9147
|
+
omitEmpty: true,
|
|
9148
|
+
},
|
|
9149
|
+
{ key: 'scheme', valueSchema: new StringSchema(), omitEmpty: true },
|
|
9150
|
+
{
|
|
9151
|
+
key: 'signature',
|
|
9152
|
+
valueSchema: new ByteArraySchema(),
|
|
9153
|
+
omitEmpty: true,
|
|
9154
|
+
},
|
|
9155
|
+
{
|
|
9156
|
+
key: 'salt',
|
|
9157
|
+
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
9158
|
+
omitEmpty: true,
|
|
9159
|
+
}
|
|
9160
|
+
);
|
|
9161
|
+
}
|
|
9162
|
+
return this.encodingSchemaValue;
|
|
9163
|
+
}
|
|
9164
|
+
|
|
9165
|
+
/**
|
|
9166
|
+
* (pk)
|
|
9167
|
+
*/
|
|
9168
|
+
public publicKey: Uint8Array;
|
|
9169
|
+
|
|
9170
|
+
/**
|
|
9171
|
+
* (sch) identifies the internal signature scheme.
|
|
9172
|
+
*/
|
|
9173
|
+
public scheme: string;
|
|
9174
|
+
|
|
9175
|
+
/**
|
|
9176
|
+
* (sig)
|
|
9177
|
+
*/
|
|
9178
|
+
public signature: Uint8Array;
|
|
9179
|
+
|
|
9180
|
+
/**
|
|
9181
|
+
* (slt) a single byte, added to ensure the hashed address is not an Ed25519 curve
|
|
9182
|
+
* point
|
|
9183
|
+
*/
|
|
9184
|
+
public salt?: number;
|
|
9185
|
+
|
|
9186
|
+
/**
|
|
9187
|
+
* Creates a new `TransactionSignaturePQsig` object.
|
|
9188
|
+
* @param publicKey - (pk)
|
|
9189
|
+
* @param scheme - (sch) identifies the internal signature scheme.
|
|
9190
|
+
* @param signature - (sig)
|
|
9191
|
+
* @param salt - (slt) a single byte, added to ensure the hashed address is not an Ed25519 curve
|
|
9192
|
+
* point
|
|
9193
|
+
*/
|
|
9194
|
+
constructor({
|
|
9195
|
+
publicKey,
|
|
9196
|
+
scheme,
|
|
9197
|
+
signature,
|
|
9198
|
+
salt,
|
|
9199
|
+
}: {
|
|
9200
|
+
publicKey: string | Uint8Array;
|
|
9201
|
+
scheme: string;
|
|
9202
|
+
signature: string | Uint8Array;
|
|
9203
|
+
salt?: number | bigint;
|
|
9204
|
+
}) {
|
|
9205
|
+
this.publicKey =
|
|
9206
|
+
typeof publicKey === 'string' ? base64ToBytes(publicKey) : publicKey;
|
|
9207
|
+
this.scheme = scheme;
|
|
9208
|
+
this.signature =
|
|
9209
|
+
typeof signature === 'string' ? base64ToBytes(signature) : signature;
|
|
9210
|
+
this.salt =
|
|
9211
|
+
typeof salt === 'undefined' ? undefined : ensureSafeInteger(salt);
|
|
9212
|
+
}
|
|
9213
|
+
|
|
9214
|
+
// eslint-disable-next-line class-methods-use-this
|
|
9215
|
+
getEncodingSchema(): Schema {
|
|
9216
|
+
return TransactionSignaturePQsig.encodingSchema;
|
|
9217
|
+
}
|
|
9218
|
+
|
|
9219
|
+
toEncodingData(): Map<string, unknown> {
|
|
9220
|
+
return new Map<string, unknown>([
|
|
9221
|
+
['public-key', this.publicKey],
|
|
9222
|
+
['scheme', this.scheme],
|
|
9223
|
+
['signature', this.signature],
|
|
9224
|
+
['salt', this.salt],
|
|
9225
|
+
]);
|
|
9226
|
+
}
|
|
9227
|
+
|
|
9228
|
+
static fromEncodingData(data: unknown): TransactionSignaturePQsig {
|
|
9229
|
+
if (!(data instanceof Map)) {
|
|
9230
|
+
throw new Error(`Invalid decoded TransactionSignaturePQsig: ${data}`);
|
|
9231
|
+
}
|
|
9232
|
+
return new TransactionSignaturePQsig({
|
|
9233
|
+
publicKey: data.get('public-key'),
|
|
9234
|
+
scheme: data.get('scheme'),
|
|
9235
|
+
signature: data.get('signature'),
|
|
9236
|
+
salt: data.get('salt'),
|
|
9237
|
+
});
|
|
9238
|
+
}
|
|
9239
|
+
}
|
|
9240
|
+
|
|
8969
9241
|
/**
|
|
8970
9242
|
* Fields for a state proof transaction.
|
|
8971
9243
|
* Definition:
|
package/src/composer.ts
CHANGED
|
@@ -241,15 +241,15 @@ export class AtomicTransactionComposer {
|
|
|
241
241
|
approvalProgram?: Uint8Array;
|
|
242
242
|
/** The clear program for this application call. Only set this if this is an application creation call, or if onComplete is OnApplicationComplete.UpdateApplicationOC */
|
|
243
243
|
clearProgram?: Uint8Array;
|
|
244
|
-
/** The global integer schema size. Only set this if this is an application creation call. */
|
|
244
|
+
/** The global integer schema size. Only set this if this is an application creation call or an OnApplicationComplete.UpdateApplicationOC call. */
|
|
245
245
|
numGlobalInts?: number;
|
|
246
|
-
/** The global byte slice schema size. Only set this if this is an application creation call. */
|
|
246
|
+
/** The global byte slice schema size. Only set this if this is an application creation call or an OnApplicationComplete.UpdateApplicationOC call. */
|
|
247
247
|
numGlobalByteSlices?: number;
|
|
248
248
|
/** The local integer schema size. Only set this if this is an application creation call. */
|
|
249
249
|
numLocalInts?: number;
|
|
250
250
|
/** The local byte slice schema size. Only set this if this is an application creation call. */
|
|
251
251
|
numLocalByteSlices?: number;
|
|
252
|
-
/** The number of extra pages to allocate for the application's programs. Only set this if this is an application creation call. If omitted, defaults to 0. */
|
|
252
|
+
/** The number of extra pages to allocate for the application's programs. Only set this if this is an application creation call or an OnApplicationComplete.UpdateApplicationOC call. If omitted, defaults to 0. */
|
|
253
253
|
extraPages?: number;
|
|
254
254
|
/** Array of Address strings that represent external accounts supplied to this application. If accounts are provided here, the accounts specified in the method args will appear after these. */
|
|
255
255
|
appAccounts?: Array<string | Address>;
|
|
@@ -306,15 +306,11 @@ export class AtomicTransactionComposer {
|
|
|
306
306
|
'One of the following required parameters for OnApplicationComplete.UpdateApplicationOC is missing: approvalProgram, clearProgram'
|
|
307
307
|
);
|
|
308
308
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
numLocalInts != null ||
|
|
313
|
-
numLocalByteSlices != null ||
|
|
314
|
-
extraPages != null
|
|
315
|
-
) {
|
|
309
|
+
// The local state schema cannot be changed after application creation. The global state
|
|
310
|
+
// schema (numGlobalInts, numGlobalByteSlices) and extraPages may be changed during an update.
|
|
311
|
+
if (numLocalInts != null || numLocalByteSlices != null) {
|
|
316
312
|
throw new Error(
|
|
317
|
-
'
|
|
313
|
+
'The local state schema cannot be changed on an update call: numLocalInts, numLocalByteSlices'
|
|
318
314
|
);
|
|
319
315
|
}
|
|
320
316
|
} else if (
|
package/src/ed25519-signer.ts
CHANGED
|
@@ -25,11 +25,40 @@ import {
|
|
|
25
25
|
} from './types/transactions/encoded.js';
|
|
26
26
|
import { arrayEqual, concatArrays } from './utils/utils.js';
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* An ed25519 public key paired with a function that signs raw bytes with the
|
|
30
|
+
* corresponding secret key.
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* `ed25519Signer` receives the exact bytes to sign, with every
|
|
34
|
+
* domain-separation prefix already applied, so it can be backed by a key that
|
|
35
|
+
* never leaves a wallet, HSM or hardware device.
|
|
36
|
+
*/
|
|
28
37
|
export interface Ed25519SigningKey {
|
|
38
|
+
/** The 32-byte ed25519 public key. */
|
|
29
39
|
ed25519PublicKey: Uint8Array;
|
|
40
|
+
/** Signs the given bytes verbatim with the corresponding secret key. */
|
|
30
41
|
ed25519Signer: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
|
|
31
42
|
}
|
|
32
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Build the full set of signers for an ed25519 key from a function that signs
|
|
46
|
+
* raw bytes with it.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* Each returned signer applies the domain separation its use requires
|
|
50
|
+
* ("Program", "MsigProgram", "ProgData", or the transaction prefix) before
|
|
51
|
+
* calling `ed25519Signer`, so a caller only has to supply the raw signing
|
|
52
|
+
* operation once.
|
|
53
|
+
*
|
|
54
|
+
* @param ed25519SigningKey - The public key and raw signing function to build the signers from
|
|
55
|
+
* @param sendingAddress - The address transactions are sent from. Defaults to
|
|
56
|
+
* the address of `ed25519PublicKey`; supply it when that key is the auth
|
|
57
|
+
* address of a rekeyed account, in which case the produced transactions carry
|
|
58
|
+
* the key's address in their `sgnr` field.
|
|
59
|
+
* @returns An address bundled with transaction, delegated LogicSig, arbitrary
|
|
60
|
+
* bytes and program data signers
|
|
61
|
+
*/
|
|
33
62
|
export function addressWithSignersFromRawEd25519Signer(
|
|
34
63
|
ed25519SigningKey: Ed25519SigningKey,
|
|
35
64
|
sendingAddress: Address = new Address(ed25519SigningKey.ed25519PublicKey)
|