algosdk 3.6.0 → 3.7.0-beta.1
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/dist/browser/algosdk.min.js +1 -1
- package/dist/browser/algosdk.min.js.map +1 -1
- package/dist/cjs/client/v2/algod/algod.js +0 -18
- package/dist/cjs/client/v2/algod/algod.js.map +1 -1
- package/dist/cjs/client/v2/algod/models/types.js +2 -434
- package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
- package/dist/cjs/ed25519-signer.js +76 -0
- package/dist/cjs/ed25519-signer.js.map +1 -0
- package/dist/cjs/encoding/address.js +61 -1
- package/dist/cjs/encoding/address.js.map +1 -1
- package/dist/cjs/falcon-signer.js +17 -0
- package/dist/cjs/falcon-signer.js.map +1 -0
- package/dist/cjs/logicsig.js +201 -16
- package/dist/cjs/logicsig.js.map +1 -1
- package/dist/cjs/main.js +32 -63
- package/dist/cjs/main.js.map +1 -1
- package/dist/cjs/mnemonic/mnemonic.js +26 -1
- package/dist/cjs/mnemonic/mnemonic.js.map +1 -1
- package/dist/cjs/multisigSigning.js +78 -1
- package/dist/cjs/multisigSigning.js.map +1 -1
- package/dist/cjs/pq-signer.js +54 -0
- package/dist/cjs/pq-signer.js.map +1 -0
- package/dist/cjs/signedTransaction.js +15 -1
- package/dist/cjs/signedTransaction.js.map +1 -1
- package/dist/cjs/signer.js.map +1 -1
- package/dist/cjs/signing.js +94 -7
- package/dist/cjs/signing.js.map +1 -1
- package/dist/cjs/transaction.js +9 -1
- package/dist/cjs/transaction.js.map +1 -1
- package/dist/cjs/types/transactions/encoded.js +51 -1
- package/dist/cjs/types/transactions/encoded.js.map +1 -1
- package/dist/cjs/utils/ed25519-check.js +69 -0
- package/dist/cjs/utils/ed25519-check.js.map +1 -0
- package/dist/esm/client/v2/algod/algod.js +0 -18
- package/dist/esm/client/v2/algod/algod.js.map +1 -1
- package/dist/esm/client/v2/algod/models/types.js +0 -427
- package/dist/esm/client/v2/algod/models/types.js.map +1 -1
- package/dist/esm/ed25519-signer.js +72 -0
- package/dist/esm/ed25519-signer.js.map +1 -0
- package/dist/esm/encoding/address.js +58 -0
- package/dist/esm/encoding/address.js.map +1 -1
- package/dist/esm/falcon-signer.js +13 -0
- package/dist/esm/falcon-signer.js.map +1 -0
- package/dist/esm/logicsig.js +200 -15
- package/dist/esm/logicsig.js.map +1 -1
- package/dist/esm/main.js +8 -56
- package/dist/esm/main.js.map +1 -1
- package/dist/esm/mnemonic/mnemonic.js +25 -1
- package/dist/esm/mnemonic/mnemonic.js.map +1 -1
- package/dist/esm/multisigSigning.js +75 -0
- package/dist/esm/multisigSigning.js.map +1 -1
- package/dist/esm/pq-signer.js +50 -0
- package/dist/esm/pq-signer.js.map +1 -0
- package/dist/esm/signedTransaction.js +16 -2
- package/dist/esm/signedTransaction.js.map +1 -1
- package/dist/esm/signer.js.map +1 -1
- package/dist/esm/signing.js +91 -8
- package/dist/esm/signing.js.map +1 -1
- package/dist/esm/transaction.js +9 -1
- package/dist/esm/transaction.js.map +1 -1
- package/dist/esm/types/transactions/encoded.js +49 -1
- package/dist/esm/types/transactions/encoded.js.map +1 -1
- package/dist/esm/utils/ed25519-check.js +65 -0
- package/dist/esm/utils/ed25519-check.js.map +1 -0
- package/dist/types/client/v2/algod/algod.d.ts +0 -16
- package/dist/types/client/v2/algod/models/types.d.ts +0 -217
- package/dist/types/ed25519-signer.d.ts +7 -0
- package/dist/types/encoding/address.d.ts +37 -0
- package/dist/types/falcon-signer.d.ts +11 -0
- package/dist/types/logicsig.d.ts +72 -1
- package/dist/types/main.d.ts +8 -44
- package/dist/types/mnemonic/mnemonic.d.ts +13 -0
- package/dist/types/multisigSigning.d.ts +49 -0
- package/dist/types/pq-signer.d.ts +8 -0
- package/dist/types/signedTransaction.d.ts +7 -2
- package/dist/types/signer.d.ts +38 -0
- package/dist/types/signing.d.ts +45 -0
- package/dist/types/transaction.d.ts +9 -0
- package/dist/types/types/transactions/encoded.d.ts +27 -0
- package/dist/types/utils/ed25519-check.d.ts +10 -0
- package/package.json +2 -1
- package/src/client/v2/algod/algod.ts +0 -19
- package/src/client/v2/algod/models/types.ts +0 -700
- package/src/ed25519-signer.ts +125 -0
- package/src/encoding/address.ts +80 -0
- package/src/falcon-signer.ts +30 -0
- package/src/logicsig.ts +258 -16
- package/src/main.ts +30 -60
- package/src/mnemonic/mnemonic.ts +34 -1
- package/src/multisigSigning.ts +111 -0
- package/src/pq-signer.ts +90 -0
- package/src/signedTransaction.ts +24 -0
- package/src/signer.ts +53 -0
- package/src/signing.ts +109 -8
- package/src/transaction.ts +9 -1
- package/src/types/transactions/encoded.ts +88 -0
- package/src/utils/ed25519-check.ts +67 -0
- package/dist/cjs/client/v2/algod/dryrun.js +0 -34
- package/dist/cjs/client/v2/algod/dryrun.js.map +0 -1
- package/dist/cjs/dryrun.js +0 -214
- package/dist/cjs/dryrun.js.map +0 -1
- package/dist/esm/client/v2/algod/dryrun.js +0 -28
- package/dist/esm/client/v2/algod/dryrun.js.map +0 -1
- package/dist/esm/dryrun.js +0 -208
- package/dist/esm/dryrun.js.map +0 -1
- package/dist/types/client/v2/algod/dryrun.d.ts +0 -11
- package/dist/types/dryrun.d.ts +0 -28
- package/src/client/v2/algod/dryrun.ts +0 -38
- package/src/dryrun.ts +0 -292
|
@@ -3943,706 +3943,6 @@ export class DisassembleResponse implements Encodable {
|
|
|
3943
3943
|
}
|
|
3944
3944
|
}
|
|
3945
3945
|
|
|
3946
|
-
/**
|
|
3947
|
-
* Request data type for dryrun endpoint. Given the Transactions and simulated
|
|
3948
|
-
* ledger state upload, run TEAL scripts and return debugging information.
|
|
3949
|
-
*/
|
|
3950
|
-
export class DryrunRequest implements Encodable {
|
|
3951
|
-
private static encodingSchemaValue: Schema | undefined;
|
|
3952
|
-
|
|
3953
|
-
static get encodingSchema(): Schema {
|
|
3954
|
-
if (!this.encodingSchemaValue) {
|
|
3955
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
3956
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
3957
|
-
{
|
|
3958
|
-
key: 'accounts',
|
|
3959
|
-
valueSchema: new ArraySchema(Account.encodingSchema),
|
|
3960
|
-
omitEmpty: true,
|
|
3961
|
-
},
|
|
3962
|
-
{
|
|
3963
|
-
key: 'apps',
|
|
3964
|
-
valueSchema: new ArraySchema(Application.encodingSchema),
|
|
3965
|
-
omitEmpty: true,
|
|
3966
|
-
},
|
|
3967
|
-
{
|
|
3968
|
-
key: 'latest-timestamp',
|
|
3969
|
-
valueSchema: new Uint64Schema(),
|
|
3970
|
-
omitEmpty: true,
|
|
3971
|
-
},
|
|
3972
|
-
{
|
|
3973
|
-
key: 'protocol-version',
|
|
3974
|
-
valueSchema: new StringSchema(),
|
|
3975
|
-
omitEmpty: true,
|
|
3976
|
-
},
|
|
3977
|
-
{ key: 'round', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
3978
|
-
{
|
|
3979
|
-
key: 'sources',
|
|
3980
|
-
valueSchema: new ArraySchema(DryrunSource.encodingSchema),
|
|
3981
|
-
omitEmpty: true,
|
|
3982
|
-
},
|
|
3983
|
-
{
|
|
3984
|
-
key: 'txns',
|
|
3985
|
-
valueSchema: new ArraySchema(SignedTransaction.encodingSchema),
|
|
3986
|
-
omitEmpty: true,
|
|
3987
|
-
}
|
|
3988
|
-
);
|
|
3989
|
-
}
|
|
3990
|
-
return this.encodingSchemaValue;
|
|
3991
|
-
}
|
|
3992
|
-
|
|
3993
|
-
public accounts: Account[];
|
|
3994
|
-
|
|
3995
|
-
public apps: Application[];
|
|
3996
|
-
|
|
3997
|
-
/**
|
|
3998
|
-
* LatestTimestamp is available to some TEAL scripts. Defaults to the latest
|
|
3999
|
-
* confirmed timestamp this algod is attached to.
|
|
4000
|
-
*/
|
|
4001
|
-
public latestTimestamp: number;
|
|
4002
|
-
|
|
4003
|
-
/**
|
|
4004
|
-
* ProtocolVersion specifies a specific version string to operate under, otherwise
|
|
4005
|
-
* whatever the current protocol of the network this algod is running in.
|
|
4006
|
-
*/
|
|
4007
|
-
public protocolVersion: string;
|
|
4008
|
-
|
|
4009
|
-
/**
|
|
4010
|
-
* Round is available to some TEAL scripts. Defaults to the current round on the
|
|
4011
|
-
* network this algod is attached to.
|
|
4012
|
-
*/
|
|
4013
|
-
public round: bigint;
|
|
4014
|
-
|
|
4015
|
-
public sources: DryrunSource[];
|
|
4016
|
-
|
|
4017
|
-
public txns: SignedTransaction[];
|
|
4018
|
-
|
|
4019
|
-
/**
|
|
4020
|
-
* Creates a new `DryrunRequest` object.
|
|
4021
|
-
* @param accounts -
|
|
4022
|
-
* @param apps -
|
|
4023
|
-
* @param latestTimestamp - LatestTimestamp is available to some TEAL scripts. Defaults to the latest
|
|
4024
|
-
* confirmed timestamp this algod is attached to.
|
|
4025
|
-
* @param protocolVersion - ProtocolVersion specifies a specific version string to operate under, otherwise
|
|
4026
|
-
* whatever the current protocol of the network this algod is running in.
|
|
4027
|
-
* @param round - Round is available to some TEAL scripts. Defaults to the current round on the
|
|
4028
|
-
* network this algod is attached to.
|
|
4029
|
-
* @param sources -
|
|
4030
|
-
* @param txns -
|
|
4031
|
-
*/
|
|
4032
|
-
constructor({
|
|
4033
|
-
accounts,
|
|
4034
|
-
apps,
|
|
4035
|
-
latestTimestamp,
|
|
4036
|
-
protocolVersion,
|
|
4037
|
-
round,
|
|
4038
|
-
sources,
|
|
4039
|
-
txns,
|
|
4040
|
-
}: {
|
|
4041
|
-
accounts: Account[];
|
|
4042
|
-
apps: Application[];
|
|
4043
|
-
latestTimestamp: number | bigint;
|
|
4044
|
-
protocolVersion: string;
|
|
4045
|
-
round: number | bigint;
|
|
4046
|
-
sources: DryrunSource[];
|
|
4047
|
-
txns: SignedTransaction[];
|
|
4048
|
-
}) {
|
|
4049
|
-
this.accounts = accounts;
|
|
4050
|
-
this.apps = apps;
|
|
4051
|
-
this.latestTimestamp = ensureSafeInteger(latestTimestamp);
|
|
4052
|
-
this.protocolVersion = protocolVersion;
|
|
4053
|
-
this.round = ensureBigInt(round);
|
|
4054
|
-
this.sources = sources;
|
|
4055
|
-
this.txns = txns;
|
|
4056
|
-
}
|
|
4057
|
-
|
|
4058
|
-
// eslint-disable-next-line class-methods-use-this
|
|
4059
|
-
getEncodingSchema(): Schema {
|
|
4060
|
-
return DryrunRequest.encodingSchema;
|
|
4061
|
-
}
|
|
4062
|
-
|
|
4063
|
-
toEncodingData(): Map<string, unknown> {
|
|
4064
|
-
return new Map<string, unknown>([
|
|
4065
|
-
['accounts', this.accounts.map((v) => v.toEncodingData())],
|
|
4066
|
-
['apps', this.apps.map((v) => v.toEncodingData())],
|
|
4067
|
-
['latest-timestamp', this.latestTimestamp],
|
|
4068
|
-
['protocol-version', this.protocolVersion],
|
|
4069
|
-
['round', this.round],
|
|
4070
|
-
['sources', this.sources.map((v) => v.toEncodingData())],
|
|
4071
|
-
['txns', this.txns.map((v) => v.toEncodingData())],
|
|
4072
|
-
]);
|
|
4073
|
-
}
|
|
4074
|
-
|
|
4075
|
-
static fromEncodingData(data: unknown): DryrunRequest {
|
|
4076
|
-
if (!(data instanceof Map)) {
|
|
4077
|
-
throw new Error(`Invalid decoded DryrunRequest: ${data}`);
|
|
4078
|
-
}
|
|
4079
|
-
return new DryrunRequest({
|
|
4080
|
-
accounts: (data.get('accounts') ?? []).map((v: unknown) =>
|
|
4081
|
-
Account.fromEncodingData(v)
|
|
4082
|
-
),
|
|
4083
|
-
apps: (data.get('apps') ?? []).map((v: unknown) =>
|
|
4084
|
-
Application.fromEncodingData(v)
|
|
4085
|
-
),
|
|
4086
|
-
latestTimestamp: data.get('latest-timestamp'),
|
|
4087
|
-
protocolVersion: data.get('protocol-version'),
|
|
4088
|
-
round: data.get('round'),
|
|
4089
|
-
sources: (data.get('sources') ?? []).map((v: unknown) =>
|
|
4090
|
-
DryrunSource.fromEncodingData(v)
|
|
4091
|
-
),
|
|
4092
|
-
txns: (data.get('txns') ?? []).map((v: unknown) =>
|
|
4093
|
-
SignedTransaction.fromEncodingData(v)
|
|
4094
|
-
),
|
|
4095
|
-
});
|
|
4096
|
-
}
|
|
4097
|
-
}
|
|
4098
|
-
|
|
4099
|
-
/**
|
|
4100
|
-
* DryrunResponse contains per-txn debug information from a dryrun.
|
|
4101
|
-
*/
|
|
4102
|
-
export class DryrunResponse implements Encodable {
|
|
4103
|
-
private static encodingSchemaValue: Schema | undefined;
|
|
4104
|
-
|
|
4105
|
-
static get encodingSchema(): Schema {
|
|
4106
|
-
if (!this.encodingSchemaValue) {
|
|
4107
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4108
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4109
|
-
{ key: 'error', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4110
|
-
{
|
|
4111
|
-
key: 'protocol-version',
|
|
4112
|
-
valueSchema: new StringSchema(),
|
|
4113
|
-
omitEmpty: true,
|
|
4114
|
-
},
|
|
4115
|
-
{
|
|
4116
|
-
key: 'txns',
|
|
4117
|
-
valueSchema: new ArraySchema(DryrunTxnResult.encodingSchema),
|
|
4118
|
-
omitEmpty: true,
|
|
4119
|
-
}
|
|
4120
|
-
);
|
|
4121
|
-
}
|
|
4122
|
-
return this.encodingSchemaValue;
|
|
4123
|
-
}
|
|
4124
|
-
|
|
4125
|
-
public error: string;
|
|
4126
|
-
|
|
4127
|
-
/**
|
|
4128
|
-
* Protocol version is the protocol version Dryrun was operated under.
|
|
4129
|
-
*/
|
|
4130
|
-
public protocolVersion: string;
|
|
4131
|
-
|
|
4132
|
-
public txns: DryrunTxnResult[];
|
|
4133
|
-
|
|
4134
|
-
/**
|
|
4135
|
-
* Creates a new `DryrunResponse` object.
|
|
4136
|
-
* @param error -
|
|
4137
|
-
* @param protocolVersion - Protocol version is the protocol version Dryrun was operated under.
|
|
4138
|
-
* @param txns -
|
|
4139
|
-
*/
|
|
4140
|
-
constructor({
|
|
4141
|
-
error,
|
|
4142
|
-
protocolVersion,
|
|
4143
|
-
txns,
|
|
4144
|
-
}: {
|
|
4145
|
-
error: string;
|
|
4146
|
-
protocolVersion: string;
|
|
4147
|
-
txns: DryrunTxnResult[];
|
|
4148
|
-
}) {
|
|
4149
|
-
this.error = error;
|
|
4150
|
-
this.protocolVersion = protocolVersion;
|
|
4151
|
-
this.txns = txns;
|
|
4152
|
-
}
|
|
4153
|
-
|
|
4154
|
-
// eslint-disable-next-line class-methods-use-this
|
|
4155
|
-
getEncodingSchema(): Schema {
|
|
4156
|
-
return DryrunResponse.encodingSchema;
|
|
4157
|
-
}
|
|
4158
|
-
|
|
4159
|
-
toEncodingData(): Map<string, unknown> {
|
|
4160
|
-
return new Map<string, unknown>([
|
|
4161
|
-
['error', this.error],
|
|
4162
|
-
['protocol-version', this.protocolVersion],
|
|
4163
|
-
['txns', this.txns.map((v) => v.toEncodingData())],
|
|
4164
|
-
]);
|
|
4165
|
-
}
|
|
4166
|
-
|
|
4167
|
-
static fromEncodingData(data: unknown): DryrunResponse {
|
|
4168
|
-
if (!(data instanceof Map)) {
|
|
4169
|
-
throw new Error(`Invalid decoded DryrunResponse: ${data}`);
|
|
4170
|
-
}
|
|
4171
|
-
return new DryrunResponse({
|
|
4172
|
-
error: data.get('error'),
|
|
4173
|
-
protocolVersion: data.get('protocol-version'),
|
|
4174
|
-
txns: (data.get('txns') ?? []).map((v: unknown) =>
|
|
4175
|
-
DryrunTxnResult.fromEncodingData(v)
|
|
4176
|
-
),
|
|
4177
|
-
});
|
|
4178
|
-
}
|
|
4179
|
-
}
|
|
4180
|
-
|
|
4181
|
-
/**
|
|
4182
|
-
* DryrunSource is TEAL source text that gets uploaded, compiled, and inserted into
|
|
4183
|
-
* transactions or application state.
|
|
4184
|
-
*/
|
|
4185
|
-
export class DryrunSource implements Encodable {
|
|
4186
|
-
private static encodingSchemaValue: Schema | undefined;
|
|
4187
|
-
|
|
4188
|
-
static get encodingSchema(): Schema {
|
|
4189
|
-
if (!this.encodingSchemaValue) {
|
|
4190
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4191
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4192
|
-
{ key: 'app-index', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
4193
|
-
{ key: 'field-name', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4194
|
-
{ key: 'source', valueSchema: new StringSchema(), omitEmpty: true },
|
|
4195
|
-
{ key: 'txn-index', valueSchema: new Uint64Schema(), omitEmpty: true }
|
|
4196
|
-
);
|
|
4197
|
-
}
|
|
4198
|
-
return this.encodingSchemaValue;
|
|
4199
|
-
}
|
|
4200
|
-
|
|
4201
|
-
public appIndex: bigint;
|
|
4202
|
-
|
|
4203
|
-
/**
|
|
4204
|
-
* FieldName is what kind of sources this is. If lsig then it goes into the
|
|
4205
|
-
* transactions[this.TxnIndex].LogicSig. If approv or clearp it goes into the
|
|
4206
|
-
* Approval Program or Clear State Program of application[this.AppIndex].
|
|
4207
|
-
*/
|
|
4208
|
-
public fieldName: string;
|
|
4209
|
-
|
|
4210
|
-
public source: string;
|
|
4211
|
-
|
|
4212
|
-
public txnIndex: number;
|
|
4213
|
-
|
|
4214
|
-
/**
|
|
4215
|
-
* Creates a new `DryrunSource` object.
|
|
4216
|
-
* @param appIndex -
|
|
4217
|
-
* @param fieldName - FieldName is what kind of sources this is. If lsig then it goes into the
|
|
4218
|
-
* transactions[this.TxnIndex].LogicSig. If approv or clearp it goes into the
|
|
4219
|
-
* Approval Program or Clear State Program of application[this.AppIndex].
|
|
4220
|
-
* @param source -
|
|
4221
|
-
* @param txnIndex -
|
|
4222
|
-
*/
|
|
4223
|
-
constructor({
|
|
4224
|
-
appIndex,
|
|
4225
|
-
fieldName,
|
|
4226
|
-
source,
|
|
4227
|
-
txnIndex,
|
|
4228
|
-
}: {
|
|
4229
|
-
appIndex: number | bigint;
|
|
4230
|
-
fieldName: string;
|
|
4231
|
-
source: string;
|
|
4232
|
-
txnIndex: number | bigint;
|
|
4233
|
-
}) {
|
|
4234
|
-
this.appIndex = ensureBigInt(appIndex);
|
|
4235
|
-
this.fieldName = fieldName;
|
|
4236
|
-
this.source = source;
|
|
4237
|
-
this.txnIndex = ensureSafeInteger(txnIndex);
|
|
4238
|
-
}
|
|
4239
|
-
|
|
4240
|
-
// eslint-disable-next-line class-methods-use-this
|
|
4241
|
-
getEncodingSchema(): Schema {
|
|
4242
|
-
return DryrunSource.encodingSchema;
|
|
4243
|
-
}
|
|
4244
|
-
|
|
4245
|
-
toEncodingData(): Map<string, unknown> {
|
|
4246
|
-
return new Map<string, unknown>([
|
|
4247
|
-
['app-index', this.appIndex],
|
|
4248
|
-
['field-name', this.fieldName],
|
|
4249
|
-
['source', this.source],
|
|
4250
|
-
['txn-index', this.txnIndex],
|
|
4251
|
-
]);
|
|
4252
|
-
}
|
|
4253
|
-
|
|
4254
|
-
static fromEncodingData(data: unknown): DryrunSource {
|
|
4255
|
-
if (!(data instanceof Map)) {
|
|
4256
|
-
throw new Error(`Invalid decoded DryrunSource: ${data}`);
|
|
4257
|
-
}
|
|
4258
|
-
return new DryrunSource({
|
|
4259
|
-
appIndex: data.get('app-index'),
|
|
4260
|
-
fieldName: data.get('field-name'),
|
|
4261
|
-
source: data.get('source'),
|
|
4262
|
-
txnIndex: data.get('txn-index'),
|
|
4263
|
-
});
|
|
4264
|
-
}
|
|
4265
|
-
}
|
|
4266
|
-
|
|
4267
|
-
/**
|
|
4268
|
-
* Stores the TEAL eval step data
|
|
4269
|
-
*/
|
|
4270
|
-
export class DryrunState implements Encodable {
|
|
4271
|
-
private static encodingSchemaValue: Schema | undefined;
|
|
4272
|
-
|
|
4273
|
-
static get encodingSchema(): Schema {
|
|
4274
|
-
if (!this.encodingSchemaValue) {
|
|
4275
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4276
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4277
|
-
{ key: 'line', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
4278
|
-
{ key: 'pc', valueSchema: new Uint64Schema(), omitEmpty: true },
|
|
4279
|
-
{
|
|
4280
|
-
key: 'stack',
|
|
4281
|
-
valueSchema: new ArraySchema(TealValue.encodingSchema),
|
|
4282
|
-
omitEmpty: true,
|
|
4283
|
-
},
|
|
4284
|
-
{
|
|
4285
|
-
key: 'error',
|
|
4286
|
-
valueSchema: new OptionalSchema(new StringSchema()),
|
|
4287
|
-
omitEmpty: true,
|
|
4288
|
-
},
|
|
4289
|
-
{
|
|
4290
|
-
key: 'scratch',
|
|
4291
|
-
valueSchema: new OptionalSchema(
|
|
4292
|
-
new ArraySchema(TealValue.encodingSchema)
|
|
4293
|
-
),
|
|
4294
|
-
omitEmpty: true,
|
|
4295
|
-
}
|
|
4296
|
-
);
|
|
4297
|
-
}
|
|
4298
|
-
return this.encodingSchemaValue;
|
|
4299
|
-
}
|
|
4300
|
-
|
|
4301
|
-
/**
|
|
4302
|
-
* Line number
|
|
4303
|
-
*/
|
|
4304
|
-
public line: number;
|
|
4305
|
-
|
|
4306
|
-
/**
|
|
4307
|
-
* Program counter
|
|
4308
|
-
*/
|
|
4309
|
-
public pc: number;
|
|
4310
|
-
|
|
4311
|
-
public stack: TealValue[];
|
|
4312
|
-
|
|
4313
|
-
/**
|
|
4314
|
-
* Evaluation error if any
|
|
4315
|
-
*/
|
|
4316
|
-
public error?: string;
|
|
4317
|
-
|
|
4318
|
-
public scratch?: TealValue[];
|
|
4319
|
-
|
|
4320
|
-
/**
|
|
4321
|
-
* Creates a new `DryrunState` object.
|
|
4322
|
-
* @param line - Line number
|
|
4323
|
-
* @param pc - Program counter
|
|
4324
|
-
* @param stack -
|
|
4325
|
-
* @param error - Evaluation error if any
|
|
4326
|
-
* @param scratch -
|
|
4327
|
-
*/
|
|
4328
|
-
constructor({
|
|
4329
|
-
line,
|
|
4330
|
-
pc,
|
|
4331
|
-
stack,
|
|
4332
|
-
error,
|
|
4333
|
-
scratch,
|
|
4334
|
-
}: {
|
|
4335
|
-
line: number | bigint;
|
|
4336
|
-
pc: number | bigint;
|
|
4337
|
-
stack: TealValue[];
|
|
4338
|
-
error?: string;
|
|
4339
|
-
scratch?: TealValue[];
|
|
4340
|
-
}) {
|
|
4341
|
-
this.line = ensureSafeInteger(line);
|
|
4342
|
-
this.pc = ensureSafeInteger(pc);
|
|
4343
|
-
this.stack = stack;
|
|
4344
|
-
this.error = error;
|
|
4345
|
-
this.scratch = scratch;
|
|
4346
|
-
}
|
|
4347
|
-
|
|
4348
|
-
// eslint-disable-next-line class-methods-use-this
|
|
4349
|
-
getEncodingSchema(): Schema {
|
|
4350
|
-
return DryrunState.encodingSchema;
|
|
4351
|
-
}
|
|
4352
|
-
|
|
4353
|
-
toEncodingData(): Map<string, unknown> {
|
|
4354
|
-
return new Map<string, unknown>([
|
|
4355
|
-
['line', this.line],
|
|
4356
|
-
['pc', this.pc],
|
|
4357
|
-
['stack', this.stack.map((v) => v.toEncodingData())],
|
|
4358
|
-
['error', this.error],
|
|
4359
|
-
[
|
|
4360
|
-
'scratch',
|
|
4361
|
-
typeof this.scratch !== 'undefined'
|
|
4362
|
-
? this.scratch.map((v) => v.toEncodingData())
|
|
4363
|
-
: undefined,
|
|
4364
|
-
],
|
|
4365
|
-
]);
|
|
4366
|
-
}
|
|
4367
|
-
|
|
4368
|
-
static fromEncodingData(data: unknown): DryrunState {
|
|
4369
|
-
if (!(data instanceof Map)) {
|
|
4370
|
-
throw new Error(`Invalid decoded DryrunState: ${data}`);
|
|
4371
|
-
}
|
|
4372
|
-
return new DryrunState({
|
|
4373
|
-
line: data.get('line'),
|
|
4374
|
-
pc: data.get('pc'),
|
|
4375
|
-
stack: (data.get('stack') ?? []).map((v: unknown) =>
|
|
4376
|
-
TealValue.fromEncodingData(v)
|
|
4377
|
-
),
|
|
4378
|
-
error: data.get('error'),
|
|
4379
|
-
scratch:
|
|
4380
|
-
typeof data.get('scratch') !== 'undefined'
|
|
4381
|
-
? data
|
|
4382
|
-
.get('scratch')
|
|
4383
|
-
.map((v: unknown) => TealValue.fromEncodingData(v))
|
|
4384
|
-
: undefined,
|
|
4385
|
-
});
|
|
4386
|
-
}
|
|
4387
|
-
}
|
|
4388
|
-
|
|
4389
|
-
/**
|
|
4390
|
-
* DryrunTxnResult contains any LogicSig or ApplicationCall program debug
|
|
4391
|
-
* information and state updates from a dryrun.
|
|
4392
|
-
*/
|
|
4393
|
-
export class DryrunTxnResult implements Encodable {
|
|
4394
|
-
private static encodingSchemaValue: Schema | undefined;
|
|
4395
|
-
|
|
4396
|
-
static get encodingSchema(): Schema {
|
|
4397
|
-
if (!this.encodingSchemaValue) {
|
|
4398
|
-
this.encodingSchemaValue = new NamedMapSchema([]);
|
|
4399
|
-
(this.encodingSchemaValue as NamedMapSchema).pushEntries(
|
|
4400
|
-
{
|
|
4401
|
-
key: 'disassembly',
|
|
4402
|
-
valueSchema: new ArraySchema(new StringSchema()),
|
|
4403
|
-
omitEmpty: true,
|
|
4404
|
-
},
|
|
4405
|
-
{
|
|
4406
|
-
key: 'app-call-messages',
|
|
4407
|
-
valueSchema: new OptionalSchema(new ArraySchema(new StringSchema())),
|
|
4408
|
-
omitEmpty: true,
|
|
4409
|
-
},
|
|
4410
|
-
{
|
|
4411
|
-
key: 'app-call-trace',
|
|
4412
|
-
valueSchema: new OptionalSchema(
|
|
4413
|
-
new ArraySchema(DryrunState.encodingSchema)
|
|
4414
|
-
),
|
|
4415
|
-
omitEmpty: true,
|
|
4416
|
-
},
|
|
4417
|
-
{
|
|
4418
|
-
key: 'budget-added',
|
|
4419
|
-
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
4420
|
-
omitEmpty: true,
|
|
4421
|
-
},
|
|
4422
|
-
{
|
|
4423
|
-
key: 'budget-consumed',
|
|
4424
|
-
valueSchema: new OptionalSchema(new Uint64Schema()),
|
|
4425
|
-
omitEmpty: true,
|
|
4426
|
-
},
|
|
4427
|
-
{
|
|
4428
|
-
key: 'global-delta',
|
|
4429
|
-
valueSchema: new OptionalSchema(
|
|
4430
|
-
new ArraySchema(EvalDeltaKeyValue.encodingSchema)
|
|
4431
|
-
),
|
|
4432
|
-
omitEmpty: true,
|
|
4433
|
-
},
|
|
4434
|
-
{
|
|
4435
|
-
key: 'local-deltas',
|
|
4436
|
-
valueSchema: new OptionalSchema(
|
|
4437
|
-
new ArraySchema(AccountStateDelta.encodingSchema)
|
|
4438
|
-
),
|
|
4439
|
-
omitEmpty: true,
|
|
4440
|
-
},
|
|
4441
|
-
{
|
|
4442
|
-
key: 'logic-sig-disassembly',
|
|
4443
|
-
valueSchema: new OptionalSchema(new ArraySchema(new StringSchema())),
|
|
4444
|
-
omitEmpty: true,
|
|
4445
|
-
},
|
|
4446
|
-
{
|
|
4447
|
-
key: 'logic-sig-messages',
|
|
4448
|
-
valueSchema: new OptionalSchema(new ArraySchema(new StringSchema())),
|
|
4449
|
-
omitEmpty: true,
|
|
4450
|
-
},
|
|
4451
|
-
{
|
|
4452
|
-
key: 'logic-sig-trace',
|
|
4453
|
-
valueSchema: new OptionalSchema(
|
|
4454
|
-
new ArraySchema(DryrunState.encodingSchema)
|
|
4455
|
-
),
|
|
4456
|
-
omitEmpty: true,
|
|
4457
|
-
},
|
|
4458
|
-
{
|
|
4459
|
-
key: 'logs',
|
|
4460
|
-
valueSchema: new OptionalSchema(
|
|
4461
|
-
new ArraySchema(new ByteArraySchema())
|
|
4462
|
-
),
|
|
4463
|
-
omitEmpty: true,
|
|
4464
|
-
}
|
|
4465
|
-
);
|
|
4466
|
-
}
|
|
4467
|
-
return this.encodingSchemaValue;
|
|
4468
|
-
}
|
|
4469
|
-
|
|
4470
|
-
/**
|
|
4471
|
-
* Disassembled program line by line.
|
|
4472
|
-
*/
|
|
4473
|
-
public disassembly: string[];
|
|
4474
|
-
|
|
4475
|
-
public appCallMessages?: string[];
|
|
4476
|
-
|
|
4477
|
-
public appCallTrace?: DryrunState[];
|
|
4478
|
-
|
|
4479
|
-
/**
|
|
4480
|
-
* Budget added during execution of app call transaction.
|
|
4481
|
-
*/
|
|
4482
|
-
public budgetAdded?: number;
|
|
4483
|
-
|
|
4484
|
-
/**
|
|
4485
|
-
* Budget consumed during execution of app call transaction.
|
|
4486
|
-
*/
|
|
4487
|
-
public budgetConsumed?: number;
|
|
4488
|
-
|
|
4489
|
-
/**
|
|
4490
|
-
* Application state delta.
|
|
4491
|
-
*/
|
|
4492
|
-
public globalDelta?: EvalDeltaKeyValue[];
|
|
4493
|
-
|
|
4494
|
-
public localDeltas?: AccountStateDelta[];
|
|
4495
|
-
|
|
4496
|
-
/**
|
|
4497
|
-
* Disassembled lsig program line by line.
|
|
4498
|
-
*/
|
|
4499
|
-
public logicSigDisassembly?: string[];
|
|
4500
|
-
|
|
4501
|
-
public logicSigMessages?: string[];
|
|
4502
|
-
|
|
4503
|
-
public logicSigTrace?: DryrunState[];
|
|
4504
|
-
|
|
4505
|
-
public logs?: Uint8Array[];
|
|
4506
|
-
|
|
4507
|
-
/**
|
|
4508
|
-
* Creates a new `DryrunTxnResult` object.
|
|
4509
|
-
* @param disassembly - Disassembled program line by line.
|
|
4510
|
-
* @param appCallMessages -
|
|
4511
|
-
* @param appCallTrace -
|
|
4512
|
-
* @param budgetAdded - Budget added during execution of app call transaction.
|
|
4513
|
-
* @param budgetConsumed - Budget consumed during execution of app call transaction.
|
|
4514
|
-
* @param globalDelta - Application state delta.
|
|
4515
|
-
* @param localDeltas -
|
|
4516
|
-
* @param logicSigDisassembly - Disassembled lsig program line by line.
|
|
4517
|
-
* @param logicSigMessages -
|
|
4518
|
-
* @param logicSigTrace -
|
|
4519
|
-
* @param logs -
|
|
4520
|
-
*/
|
|
4521
|
-
constructor({
|
|
4522
|
-
disassembly,
|
|
4523
|
-
appCallMessages,
|
|
4524
|
-
appCallTrace,
|
|
4525
|
-
budgetAdded,
|
|
4526
|
-
budgetConsumed,
|
|
4527
|
-
globalDelta,
|
|
4528
|
-
localDeltas,
|
|
4529
|
-
logicSigDisassembly,
|
|
4530
|
-
logicSigMessages,
|
|
4531
|
-
logicSigTrace,
|
|
4532
|
-
logs,
|
|
4533
|
-
}: {
|
|
4534
|
-
disassembly: string[];
|
|
4535
|
-
appCallMessages?: string[];
|
|
4536
|
-
appCallTrace?: DryrunState[];
|
|
4537
|
-
budgetAdded?: number | bigint;
|
|
4538
|
-
budgetConsumed?: number | bigint;
|
|
4539
|
-
globalDelta?: EvalDeltaKeyValue[];
|
|
4540
|
-
localDeltas?: AccountStateDelta[];
|
|
4541
|
-
logicSigDisassembly?: string[];
|
|
4542
|
-
logicSigMessages?: string[];
|
|
4543
|
-
logicSigTrace?: DryrunState[];
|
|
4544
|
-
logs?: Uint8Array[];
|
|
4545
|
-
}) {
|
|
4546
|
-
this.disassembly = disassembly;
|
|
4547
|
-
this.appCallMessages = appCallMessages;
|
|
4548
|
-
this.appCallTrace = appCallTrace;
|
|
4549
|
-
this.budgetAdded =
|
|
4550
|
-
typeof budgetAdded === 'undefined'
|
|
4551
|
-
? undefined
|
|
4552
|
-
: ensureSafeInteger(budgetAdded);
|
|
4553
|
-
this.budgetConsumed =
|
|
4554
|
-
typeof budgetConsumed === 'undefined'
|
|
4555
|
-
? undefined
|
|
4556
|
-
: ensureSafeInteger(budgetConsumed);
|
|
4557
|
-
this.globalDelta = globalDelta;
|
|
4558
|
-
this.localDeltas = localDeltas;
|
|
4559
|
-
this.logicSigDisassembly = logicSigDisassembly;
|
|
4560
|
-
this.logicSigMessages = logicSigMessages;
|
|
4561
|
-
this.logicSigTrace = logicSigTrace;
|
|
4562
|
-
this.logs = logs;
|
|
4563
|
-
}
|
|
4564
|
-
|
|
4565
|
-
// eslint-disable-next-line class-methods-use-this
|
|
4566
|
-
getEncodingSchema(): Schema {
|
|
4567
|
-
return DryrunTxnResult.encodingSchema;
|
|
4568
|
-
}
|
|
4569
|
-
|
|
4570
|
-
toEncodingData(): Map<string, unknown> {
|
|
4571
|
-
return new Map<string, unknown>([
|
|
4572
|
-
['disassembly', this.disassembly],
|
|
4573
|
-
['app-call-messages', this.appCallMessages],
|
|
4574
|
-
[
|
|
4575
|
-
'app-call-trace',
|
|
4576
|
-
typeof this.appCallTrace !== 'undefined'
|
|
4577
|
-
? this.appCallTrace.map((v) => v.toEncodingData())
|
|
4578
|
-
: undefined,
|
|
4579
|
-
],
|
|
4580
|
-
['budget-added', this.budgetAdded],
|
|
4581
|
-
['budget-consumed', this.budgetConsumed],
|
|
4582
|
-
[
|
|
4583
|
-
'global-delta',
|
|
4584
|
-
typeof this.globalDelta !== 'undefined'
|
|
4585
|
-
? this.globalDelta.map((v) => v.toEncodingData())
|
|
4586
|
-
: undefined,
|
|
4587
|
-
],
|
|
4588
|
-
[
|
|
4589
|
-
'local-deltas',
|
|
4590
|
-
typeof this.localDeltas !== 'undefined'
|
|
4591
|
-
? this.localDeltas.map((v) => v.toEncodingData())
|
|
4592
|
-
: undefined,
|
|
4593
|
-
],
|
|
4594
|
-
['logic-sig-disassembly', this.logicSigDisassembly],
|
|
4595
|
-
['logic-sig-messages', this.logicSigMessages],
|
|
4596
|
-
[
|
|
4597
|
-
'logic-sig-trace',
|
|
4598
|
-
typeof this.logicSigTrace !== 'undefined'
|
|
4599
|
-
? this.logicSigTrace.map((v) => v.toEncodingData())
|
|
4600
|
-
: undefined,
|
|
4601
|
-
],
|
|
4602
|
-
['logs', this.logs],
|
|
4603
|
-
]);
|
|
4604
|
-
}
|
|
4605
|
-
|
|
4606
|
-
static fromEncodingData(data: unknown): DryrunTxnResult {
|
|
4607
|
-
if (!(data instanceof Map)) {
|
|
4608
|
-
throw new Error(`Invalid decoded DryrunTxnResult: ${data}`);
|
|
4609
|
-
}
|
|
4610
|
-
return new DryrunTxnResult({
|
|
4611
|
-
disassembly: data.get('disassembly'),
|
|
4612
|
-
appCallMessages: data.get('app-call-messages'),
|
|
4613
|
-
appCallTrace:
|
|
4614
|
-
typeof data.get('app-call-trace') !== 'undefined'
|
|
4615
|
-
? data
|
|
4616
|
-
.get('app-call-trace')
|
|
4617
|
-
.map((v: unknown) => DryrunState.fromEncodingData(v))
|
|
4618
|
-
: undefined,
|
|
4619
|
-
budgetAdded: data.get('budget-added'),
|
|
4620
|
-
budgetConsumed: data.get('budget-consumed'),
|
|
4621
|
-
globalDelta:
|
|
4622
|
-
typeof data.get('global-delta') !== 'undefined'
|
|
4623
|
-
? data
|
|
4624
|
-
.get('global-delta')
|
|
4625
|
-
.map((v: unknown) => EvalDeltaKeyValue.fromEncodingData(v))
|
|
4626
|
-
: undefined,
|
|
4627
|
-
localDeltas:
|
|
4628
|
-
typeof data.get('local-deltas') !== 'undefined'
|
|
4629
|
-
? data
|
|
4630
|
-
.get('local-deltas')
|
|
4631
|
-
.map((v: unknown) => AccountStateDelta.fromEncodingData(v))
|
|
4632
|
-
: undefined,
|
|
4633
|
-
logicSigDisassembly: data.get('logic-sig-disassembly'),
|
|
4634
|
-
logicSigMessages: data.get('logic-sig-messages'),
|
|
4635
|
-
logicSigTrace:
|
|
4636
|
-
typeof data.get('logic-sig-trace') !== 'undefined'
|
|
4637
|
-
? data
|
|
4638
|
-
.get('logic-sig-trace')
|
|
4639
|
-
.map((v: unknown) => DryrunState.fromEncodingData(v))
|
|
4640
|
-
: undefined,
|
|
4641
|
-
logs: data.get('logs'),
|
|
4642
|
-
});
|
|
4643
|
-
}
|
|
4644
|
-
}
|
|
4645
|
-
|
|
4646
3946
|
/**
|
|
4647
3947
|
* An error response with optional data field.
|
|
4648
3948
|
*/
|