algosdk 3.7.0-beta.1 → 3.7.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.
Files changed (73) hide show
  1. package/README.md +4 -4
  2. package/dist/browser/algosdk.min.js +1 -1
  3. package/dist/browser/algosdk.min.js.map +1 -1
  4. package/dist/cjs/appAccess.js +4 -0
  5. package/dist/cjs/appAccess.js.map +1 -1
  6. package/dist/cjs/client/v2/algod/models/types.js +153 -5
  7. package/dist/cjs/client/v2/algod/models/types.js.map +1 -1
  8. package/dist/cjs/client/v2/indexer/models/types.js +163 -12
  9. package/dist/cjs/client/v2/indexer/models/types.js.map +1 -1
  10. package/dist/cjs/composer.js +4 -6
  11. package/dist/cjs/composer.js.map +1 -1
  12. package/dist/cjs/falcon-signer.js.map +1 -1
  13. package/dist/cjs/heartbeat.js +7 -0
  14. package/dist/cjs/heartbeat.js.map +1 -1
  15. package/dist/cjs/makeTxn.js +11 -2
  16. package/dist/cjs/makeTxn.js.map +1 -1
  17. package/dist/cjs/pq-signer.js +26 -0
  18. package/dist/cjs/pq-signer.js.map +1 -1
  19. package/dist/cjs/signer.js.map +1 -1
  20. package/dist/cjs/transaction.js +8 -0
  21. package/dist/cjs/transaction.js.map +1 -1
  22. package/dist/cjs/types/statedelta.js +17 -0
  23. package/dist/cjs/types/statedelta.js.map +1 -1
  24. package/dist/cjs/utils/utils.js +14 -1
  25. package/dist/cjs/utils/utils.js.map +1 -1
  26. package/dist/esm/appAccess.js +4 -0
  27. package/dist/esm/appAccess.js.map +1 -1
  28. package/dist/esm/client/v2/algod/models/types.js +149 -3
  29. package/dist/esm/client/v2/algod/models/types.js.map +1 -1
  30. package/dist/esm/client/v2/indexer/models/types.js +161 -11
  31. package/dist/esm/client/v2/indexer/models/types.js.map +1 -1
  32. package/dist/esm/composer.js +4 -6
  33. package/dist/esm/composer.js.map +1 -1
  34. package/dist/esm/falcon-signer.js.map +1 -1
  35. package/dist/esm/heartbeat.js +8 -1
  36. package/dist/esm/heartbeat.js.map +1 -1
  37. package/dist/esm/makeTxn.js +11 -2
  38. package/dist/esm/makeTxn.js.map +1 -1
  39. package/dist/esm/pq-signer.js +26 -0
  40. package/dist/esm/pq-signer.js.map +1 -1
  41. package/dist/esm/signer.js.map +1 -1
  42. package/dist/esm/transaction.js +8 -0
  43. package/dist/esm/transaction.js.map +1 -1
  44. package/dist/esm/types/statedelta.js +17 -0
  45. package/dist/esm/types/statedelta.js.map +1 -1
  46. package/dist/esm/utils/utils.js +12 -0
  47. package/dist/esm/utils/utils.js.map +1 -1
  48. package/dist/types/client/v2/algod/models/types.d.ts +90 -3
  49. package/dist/types/client/v2/indexer/models/types.d.ts +114 -7
  50. package/dist/types/composer.d.ts +3 -3
  51. package/dist/types/falcon-signer.d.ts +2 -2
  52. package/dist/types/heartbeat.d.ts +2 -0
  53. package/dist/types/makeTxn.d.ts +8 -2
  54. package/dist/types/pq-signer.d.ts +2 -2
  55. package/dist/types/signer.d.ts +8 -0
  56. package/dist/types/transaction.d.ts +1 -0
  57. package/dist/types/types/statedelta.d.ts +18 -0
  58. package/dist/types/types/transactions/base.d.ts +10 -0
  59. package/dist/types/utils/utils.d.ts +1 -0
  60. package/package.json +2 -2
  61. package/src/appAccess.ts +5 -0
  62. package/src/client/v2/algod/models/types.ts +234 -0
  63. package/src/client/v2/indexer/models/types.ts +280 -8
  64. package/src/composer.ts +7 -11
  65. package/src/falcon-signer.ts +4 -1
  66. package/src/heartbeat.ts +11 -0
  67. package/src/makeTxn.ts +13 -4
  68. package/src/pq-signer.ts +34 -1
  69. package/src/signer.ts +9 -0
  70. package/src/transaction.ts +10 -0
  71. package/src/types/statedelta.ts +34 -0
  72. package/src/types/transactions/base.ts +11 -0
  73. package/src/utils/utils.ts +13 -0
@@ -93,15 +93,15 @@ export declare class AtomicTransactionComposer {
93
93
  approvalProgram?: Uint8Array;
94
94
  /** The clear program for this application call. Only set this if this is an application creation call, or if onComplete is OnApplicationComplete.UpdateApplicationOC */
95
95
  clearProgram?: Uint8Array;
96
- /** The global integer schema size. Only set this if this is an application creation call. */
96
+ /** The global integer schema size. Only set this if this is an application creation call or an OnApplicationComplete.UpdateApplicationOC call. */
97
97
  numGlobalInts?: number;
98
- /** The global byte slice schema size. Only set this if this is an application creation call. */
98
+ /** The global byte slice schema size. Only set this if this is an application creation call or an OnApplicationComplete.UpdateApplicationOC call. */
99
99
  numGlobalByteSlices?: number;
100
100
  /** The local integer schema size. Only set this if this is an application creation call. */
101
101
  numLocalInts?: number;
102
102
  /** The local byte slice schema size. Only set this if this is an application creation call. */
103
103
  numLocalByteSlices?: number;
104
- /** 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. */
104
+ /** 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. */
105
105
  extraPages?: number;
106
106
  /** 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. */
107
107
  appAccounts?: Array<string | Address>;
@@ -1,5 +1,5 @@
1
1
  import { Address } from './encoding/address.js';
2
- import { AddressWithDelegatedLsigSigner, AddressWithTransactionSigner } from './signer.js';
2
+ import { AddressWithDelegatedLsigSigner, AddressWithEmptyTransactionSigner, AddressWithTransactionSigner } from './signer.js';
3
3
  /**
4
4
  * The 2-byte ASCII identifier of the Falcon-1024 post-quantum signature scheme.
5
5
  */
@@ -8,4 +8,4 @@ export interface Falcon1024SigningKey {
8
8
  falcon1024PublicKey: Uint8Array;
9
9
  falcon1024Signer: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
10
10
  }
11
- export declare function addressWithSignersFromRawFalcon1024Signer(falconSigningKey: Falcon1024SigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner;
11
+ export declare function addressWithSignersFromRawFalcon1024Signer(falconSigningKey: Falcon1024SigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner & AddressWithEmptyTransactionSigner;
@@ -26,12 +26,14 @@ export declare class Heartbeat implements Encodable {
26
26
  seed: Uint8Array;
27
27
  voteID: Uint8Array;
28
28
  keyDilution: bigint;
29
+ challengeDiscount: boolean;
29
30
  constructor(params: {
30
31
  address: Address;
31
32
  proof: HeartbeatProof;
32
33
  seed: Uint8Array;
33
34
  voteID: Uint8Array;
34
35
  keyDilution: bigint;
36
+ challengeDiscount?: boolean;
35
37
  });
36
38
  getEncodingSchema(): Schema;
37
39
  toEncodingData(): Map<string, unknown>;
@@ -128,11 +128,17 @@ export declare function makeApplicationCallTxnFromObject({ sender, appIndex, onC
128
128
  */
129
129
  export declare function makeApplicationCreateTxnFromObject({ sender, onComplete, appArgs, accounts, foreignApps, foreignAssets, boxes, convertToAccess, holdings, locals, access, approvalProgram, clearProgram, numLocalInts, numLocalByteSlices, numGlobalInts, numGlobalByteSlices, extraPages, note, lease, rekeyTo, suggestedParams, }: Omit<ApplicationCallTransactionParams, 'appIndex' | 'approvalProgram' | 'clearProgram'> & Required<Pick<ApplicationCallTransactionParams, 'approvalProgram' | 'clearProgram'>> & CommonTransactionParams & ApplicationCallReferenceParams): Transaction;
130
130
  /**
131
- * Make a transaction that changes an application's approval and clear programs
131
+ * Make a transaction that changes an application's approval and clear programs.
132
+ *
133
+ * The application's global state schema and extra program pages may also be changed during an
134
+ * update by providing numGlobalInts, numGlobalByteSlices, and/or extraPages. The local state schema
135
+ * cannot be changed after application creation. If the pages or global schema increases in size, the entire
136
+ * MBR for the application will move to the sender of the update and that account will become the `sizeSponsor`
137
+ * in the application's parameters. A decrease in schema or pages does not affect MBR or `sizeSponsor`.
132
138
  *
133
139
  * @param options - Application update transaction parameters
134
140
  */
135
- export declare function makeApplicationUpdateTxnFromObject({ sender, appIndex, appArgs, accounts, foreignApps, foreignAssets, boxes, convertToAccess, holdings, locals, access, approvalProgram, clearProgram, note, lease, rekeyTo, suggestedParams, }: Omit<ApplicationCallTransactionParams, 'onComplete' | 'numLocalInts' | 'numLocalByteSlices' | 'numGlobalInts' | 'numGlobalByteSlices' | 'extraPages' | 'approvalProgram' | 'clearProgram'> & Required<Pick<ApplicationCallTransactionParams, 'approvalProgram' | 'clearProgram'>> & CommonTransactionParams & ApplicationCallReferenceParams): Transaction;
141
+ export declare function makeApplicationUpdateTxnFromObject({ sender, appIndex, appArgs, accounts, foreignApps, foreignAssets, boxes, convertToAccess, holdings, locals, access, approvalProgram, clearProgram, numGlobalInts, numGlobalByteSlices, extraPages, note, lease, rekeyTo, suggestedParams, }: Omit<ApplicationCallTransactionParams, 'onComplete' | 'numLocalInts' | 'numLocalByteSlices' | 'approvalProgram' | 'clearProgram'> & Required<Pick<ApplicationCallTransactionParams, 'approvalProgram' | 'clearProgram'>> & CommonTransactionParams & ApplicationCallReferenceParams): Transaction;
136
142
  /**
137
143
  * Make a transaction that deletes an application
138
144
  *
@@ -1,8 +1,8 @@
1
1
  import { Address } from './encoding/address.js';
2
- import { AddressWithDelegatedLsigSigner, AddressWithTransactionSigner } from './signer.js';
2
+ import { AddressWithDelegatedLsigSigner, AddressWithEmptyTransactionSigner, AddressWithTransactionSigner } from './signer.js';
3
3
  export interface PQSigningKey {
4
4
  pqScheme: Uint8Array;
5
5
  pqPublicKey: Uint8Array;
6
6
  pqSigner: (bytesToSign: Uint8Array) => Promise<Uint8Array>;
7
7
  }
8
- export declare function addressWithSignersFromRawPQSigner(signingKey: PQSigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner;
8
+ export declare function addressWithSignersFromRawPQSigner(signingKey: PQSigningKey, sendingAddress?: Address): AddressWithTransactionSigner & AddressWithDelegatedLsigSigner & AddressWithEmptyTransactionSigner;
@@ -24,6 +24,14 @@ export type TransactionSigner = (txnGroup: Transaction[], indexesToSign: number[
24
24
  export interface AddressWithTransactionSigner extends Addressable {
25
25
  txnSigner: TransactionSigner;
26
26
  }
27
+ export interface AddressWithEmptyTransactionSigner extends Addressable {
28
+ /**
29
+ * A TransactionSigner that produces unsigned (or placeholder-signed)
30
+ * transactions. This must only be used to simulate transactions with the
31
+ * `allowEmptySignatures` option enabled.
32
+ */
33
+ emptyTxnSigner: TransactionSigner;
34
+ }
27
35
  /** Function for signing logic signatures for delegation
28
36
  * @param lsig - The logic signature that is being signed for delegation
29
37
  * @param msig - Optional multisig account that should be set when a public key is signing as a subsigner of a multisig
@@ -93,6 +93,7 @@ export interface HeartbeatTransactionFields {
93
93
  readonly seed: Uint8Array;
94
94
  readonly voteID: Uint8Array;
95
95
  readonly keyDilution: bigint;
96
+ readonly challengeDiscount: boolean;
96
97
  }
97
98
  /**
98
99
  * Transaction enables construction of Algorand transactions
@@ -48,6 +48,20 @@ export declare class AppParams implements Encodable {
48
48
  localStateSchema: StateSchema;
49
49
  globalStateSchema: StateSchema;
50
50
  extraProgramPages: number;
51
+ version: bigint;
52
+ /**
53
+ * If non-zero, the account that must hold MBR for extra program pages and the
54
+ * global schema.
55
+ */
56
+ sizeSponsor: Address;
57
+ /**
58
+ * When true, any app may read this app's boxes.
59
+ */
60
+ foreignBoxReads: boolean;
61
+ /**
62
+ * When true, apps with the same creator may read and write this app's boxes.
63
+ */
64
+ familyBoxAccess: boolean;
51
65
  constructor(params: {
52
66
  approvalProgram: Uint8Array;
53
67
  clearStateProgram: Uint8Array;
@@ -55,6 +69,10 @@ export declare class AppParams implements Encodable {
55
69
  localStateSchema: StateSchema;
56
70
  globalStateSchema: StateSchema;
57
71
  extraProgramPages: number;
72
+ version?: bigint;
73
+ sizeSponsor?: Address;
74
+ foreignBoxReads?: boolean;
75
+ familyBoxAccess?: boolean;
58
76
  });
59
77
  getEncodingSchema(): Schema;
60
78
  toEncodingData(): Map<string, unknown>;
@@ -473,6 +473,16 @@ export interface HeartbeatTransactionParams {
473
473
  * Must match hbAddress account's current KeyDilution.
474
474
  */
475
475
  keyDilution: bigint;
476
+ /**
477
+ * Requests the challenge fee discount: when set, the required fee is reduced
478
+ * by one min fee. The network verifies that hbAddress is actually under
479
+ * challenge before granting it, and a heartbeat claiming the discount may not
480
+ * carry any extra fields (note, lease, group, etc.).
481
+ *
482
+ * Only allowed once transaction size pricing is enabled. Before that, the
483
+ * discount was inferred from an underpaid singleton heartbeat instead.
484
+ */
485
+ challengeDiscount?: boolean;
476
486
  }
477
487
  /**
478
488
  * A full list of all available transaction parameters
@@ -55,3 +55,4 @@ export declare function ensureSafeInteger(value: unknown): number;
55
55
  export declare function ensureSafeUnsignedInteger(value: unknown): number;
56
56
  export declare function ensureBigInt(value: unknown): bigint;
57
57
  export declare function ensureUint64(value: unknown): bigint;
58
+ export declare function isEmptyObject(obj: any): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "algosdk",
3
- "version": "3.7.0-beta.1",
3
+ "version": "3.7.0",
4
4
  "description": "The official JavaScript SDK for Algorand",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -75,7 +75,7 @@
75
75
  "eslint-plugin-import": "^2.25.2",
76
76
  "eslint-plugin-tsdoc": "^0.2.11",
77
77
  "express": "^4.19.2",
78
- "falcon-1024": "1.0.0-beta.2",
78
+ "@algorandfoundation/falcon-wasm": "1.0.0",
79
79
  "geckodriver": "^4.3.0",
80
80
  "husky": "^4.3.8",
81
81
  "lint-staged": "^10.5.4",
package/src/appAccess.ts CHANGED
@@ -113,7 +113,12 @@ export function resourceReferencesToEncodingData(
113
113
  ],
114
114
  ])
115
115
  );
116
+ continue;
116
117
  }
118
+
119
+ // A reference that names no resource encodes as an empty ResourceRef, which
120
+ // the network reads as a request for a box I/O quota bump.
121
+ accessList.push(new Map<string, unknown>());
117
122
  }
118
123
  return accessList;
119
124
  }
@@ -2070,6 +2070,16 @@ export class ApplicationParams implements Encodable {
2070
2070
  valueSchema: new OptionalSchema(new Uint64Schema()),
2071
2071
  omitEmpty: true,
2072
2072
  },
2073
+ {
2074
+ key: 'family-box-access',
2075
+ valueSchema: new OptionalSchema(new BooleanSchema()),
2076
+ omitEmpty: true,
2077
+ },
2078
+ {
2079
+ key: 'foreign-box-reads',
2080
+ valueSchema: new OptionalSchema(new BooleanSchema()),
2081
+ omitEmpty: true,
2082
+ },
2073
2083
  {
2074
2084
  key: 'global-state',
2075
2085
  valueSchema: new OptionalSchema(
@@ -2127,6 +2137,16 @@ export class ApplicationParams implements Encodable {
2127
2137
  */
2128
2138
  public extraProgramPages?: number;
2129
2139
 
2140
+ /**
2141
+ * (fba) if true, apps with the same creator may read and write this app's boxes
2142
+ */
2143
+ public familyBoxAccess?: boolean;
2144
+
2145
+ /**
2146
+ * (fbr) if true, any app may read this app's boxes
2147
+ */
2148
+ public foreignBoxReads?: boolean;
2149
+
2130
2150
  /**
2131
2151
  * (gs) global state
2132
2152
  */
@@ -2159,6 +2179,8 @@ export class ApplicationParams implements Encodable {
2159
2179
  * @param creator - The address that created this application. This is the address where the
2160
2180
  * parameters and global state for this application can be found.
2161
2181
  * @param extraProgramPages - (epp) the amount of extra program pages available to this app.
2182
+ * @param familyBoxAccess - (fba) if true, apps with the same creator may read and write this app's boxes
2183
+ * @param foreignBoxReads - (fbr) if true, any app may read this app's boxes
2162
2184
  * @param globalState - (gs) global state
2163
2185
  * @param globalStateSchema - (gsch) global schema
2164
2186
  * @param localStateSchema - (lsch) local schema
@@ -2170,6 +2192,8 @@ export class ApplicationParams implements Encodable {
2170
2192
  clearStateProgram,
2171
2193
  creator,
2172
2194
  extraProgramPages,
2195
+ familyBoxAccess,
2196
+ foreignBoxReads,
2173
2197
  globalState,
2174
2198
  globalStateSchema,
2175
2199
  localStateSchema,
@@ -2180,6 +2204,8 @@ export class ApplicationParams implements Encodable {
2180
2204
  clearStateProgram: string | Uint8Array;
2181
2205
  creator: Address | string;
2182
2206
  extraProgramPages?: number | bigint;
2207
+ familyBoxAccess?: boolean;
2208
+ foreignBoxReads?: boolean;
2183
2209
  globalState?: TealKeyValue[];
2184
2210
  globalStateSchema?: ApplicationStateSchema;
2185
2211
  localStateSchema?: ApplicationStateSchema;
@@ -2200,6 +2226,8 @@ export class ApplicationParams implements Encodable {
2200
2226
  typeof extraProgramPages === 'undefined'
2201
2227
  ? undefined
2202
2228
  : ensureSafeInteger(extraProgramPages);
2229
+ this.familyBoxAccess = familyBoxAccess;
2230
+ this.foreignBoxReads = foreignBoxReads;
2203
2231
  this.globalState = globalState;
2204
2232
  this.globalStateSchema = globalStateSchema;
2205
2233
  this.localStateSchema = localStateSchema;
@@ -2222,6 +2250,8 @@ export class ApplicationParams implements Encodable {
2222
2250
  ['clear-state-program', this.clearStateProgram],
2223
2251
  ['creator', this.creator.toString()],
2224
2252
  ['extra-program-pages', this.extraProgramPages],
2253
+ ['family-box-access', this.familyBoxAccess],
2254
+ ['foreign-box-reads', this.foreignBoxReads],
2225
2255
  [
2226
2256
  'global-state',
2227
2257
  typeof this.globalState !== 'undefined'
@@ -2259,6 +2289,8 @@ export class ApplicationParams implements Encodable {
2259
2289
  clearStateProgram: data.get('clear-state-program'),
2260
2290
  creator: data.get('creator'),
2261
2291
  extraProgramPages: data.get('extra-program-pages'),
2292
+ familyBoxAccess: data.get('family-box-access'),
2293
+ foreignBoxReads: data.get('foreign-box-reads'),
2262
2294
  globalState:
2263
2295
  typeof data.get('global-state') !== 'undefined'
2264
2296
  ? data
@@ -4408,6 +4440,57 @@ export class GetBlockTimeStampOffsetResponse implements Encodable {
4408
4440
  }
4409
4441
  }
4410
4442
 
4443
+ /**
4444
+ * Response containing the network peers of the node
4445
+ */
4446
+ export class GetPeersResponse implements Encodable {
4447
+ private static encodingSchemaValue: Schema | undefined;
4448
+
4449
+ static get encodingSchema(): Schema {
4450
+ if (!this.encodingSchemaValue) {
4451
+ this.encodingSchemaValue = new NamedMapSchema([]);
4452
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries({
4453
+ key: 'Peers',
4454
+ valueSchema: new ArraySchema(PeerStatus.encodingSchema),
4455
+ omitEmpty: true,
4456
+ });
4457
+ }
4458
+ return this.encodingSchemaValue;
4459
+ }
4460
+
4461
+ public peers: PeerStatus[];
4462
+
4463
+ /**
4464
+ * Creates a new `GetPeersResponse` object.
4465
+ * @param peers -
4466
+ */
4467
+ constructor({ peers }: { peers: PeerStatus[] }) {
4468
+ this.peers = peers;
4469
+ }
4470
+
4471
+ // eslint-disable-next-line class-methods-use-this
4472
+ getEncodingSchema(): Schema {
4473
+ return GetPeersResponse.encodingSchema;
4474
+ }
4475
+
4476
+ toEncodingData(): Map<string, unknown> {
4477
+ return new Map<string, unknown>([
4478
+ ['Peers', this.peers.map((v) => v.toEncodingData())],
4479
+ ]);
4480
+ }
4481
+
4482
+ static fromEncodingData(data: unknown): GetPeersResponse {
4483
+ if (!(data instanceof Map)) {
4484
+ throw new Error(`Invalid decoded GetPeersResponse: ${data}`);
4485
+ }
4486
+ return new GetPeersResponse({
4487
+ peers: (data.get('Peers') ?? []).map((v: unknown) =>
4488
+ PeerStatus.fromEncodingData(v)
4489
+ ),
4490
+ });
4491
+ }
4492
+ }
4493
+
4411
4494
  /**
4412
4495
  * Response containing the ledger's minimum sync round
4413
4496
  */
@@ -5122,6 +5205,96 @@ export class NodeStatusResponse implements Encodable {
5122
5205
  }
5123
5206
  }
5124
5207
 
5208
+ /**
5209
+ * The status of a connected peer in the P2P network
5210
+ */
5211
+ export class PeerStatus implements Encodable {
5212
+ private static encodingSchemaValue: Schema | undefined;
5213
+
5214
+ static get encodingSchema(): Schema {
5215
+ if (!this.encodingSchemaValue) {
5216
+ this.encodingSchemaValue = new NamedMapSchema([]);
5217
+ (this.encodingSchemaValue as NamedMapSchema).pushEntries(
5218
+ {
5219
+ key: 'network-address',
5220
+ valueSchema: new StringSchema(),
5221
+ omitEmpty: true,
5222
+ },
5223
+ {
5224
+ key: 'connection-type',
5225
+ valueSchema: new OptionalSchema(new StringSchema()),
5226
+ omitEmpty: true,
5227
+ },
5228
+ {
5229
+ key: 'network-type',
5230
+ valueSchema: new OptionalSchema(new StringSchema()),
5231
+ omitEmpty: true,
5232
+ }
5233
+ );
5234
+ }
5235
+ return this.encodingSchemaValue;
5236
+ }
5237
+
5238
+ /**
5239
+ * Network address of the peer
5240
+ */
5241
+ public networkAddress: string;
5242
+
5243
+ /**
5244
+ * Connection type
5245
+ */
5246
+ public connectionType?: string;
5247
+
5248
+ /**
5249
+ * Network type
5250
+ */
5251
+ public networkType?: string;
5252
+
5253
+ /**
5254
+ * Creates a new `PeerStatus` object.
5255
+ * @param networkAddress - Network address of the peer
5256
+ * @param connectionType - Connection type
5257
+ * @param networkType - Network type
5258
+ */
5259
+ constructor({
5260
+ networkAddress,
5261
+ connectionType,
5262
+ networkType,
5263
+ }: {
5264
+ networkAddress: string;
5265
+ connectionType?: string;
5266
+ networkType?: string;
5267
+ }) {
5268
+ this.networkAddress = networkAddress;
5269
+ this.connectionType = connectionType;
5270
+ this.networkType = networkType;
5271
+ }
5272
+
5273
+ // eslint-disable-next-line class-methods-use-this
5274
+ getEncodingSchema(): Schema {
5275
+ return PeerStatus.encodingSchema;
5276
+ }
5277
+
5278
+ toEncodingData(): Map<string, unknown> {
5279
+ return new Map<string, unknown>([
5280
+ ['network-address', this.networkAddress],
5281
+ ['connection-type', this.connectionType],
5282
+ ['network-type', this.networkType],
5283
+ ]);
5284
+ }
5285
+
5286
+ static fromEncodingData(data: unknown): PeerStatus {
5287
+ if (!(data instanceof Map)) {
5288
+ throw new Error(`Invalid decoded PeerStatus: ${data}`);
5289
+ }
5290
+ return new PeerStatus({
5291
+ networkAddress: data.get('network-address'),
5292
+ connectionType: data.get('connection-type'),
5293
+ networkType: data.get('network-type'),
5294
+ });
5295
+ }
5296
+ }
5297
+
5125
5298
  /**
5126
5299
  * Details about a pending transaction. If the transaction was recently confirmed,
5127
5300
  * includes confirmation details like the round and reward details.
@@ -6291,6 +6464,16 @@ export class SimulateTransactionGroupResult implements Encodable {
6291
6464
  valueSchema: new OptionalSchema(new StringSchema()),
6292
6465
  omitEmpty: true,
6293
6466
  },
6467
+ {
6468
+ key: 'group-fees-paid',
6469
+ valueSchema: new OptionalSchema(new Uint64Schema()),
6470
+ omitEmpty: true,
6471
+ },
6472
+ {
6473
+ key: 'group-usage',
6474
+ valueSchema: new OptionalSchema(new Uint64Schema()),
6475
+ omitEmpty: true,
6476
+ },
6294
6477
  {
6295
6478
  key: 'unnamed-resources-accessed',
6296
6479
  valueSchema: new OptionalSchema(
@@ -6332,6 +6515,18 @@ export class SimulateTransactionGroupResult implements Encodable {
6332
6515
  */
6333
6516
  public failureMessage?: string;
6334
6517
 
6518
+ /**
6519
+ * Total fees paid by the transaction group and all of its descendant inner
6520
+ * transaction groups.
6521
+ */
6522
+ public groupFeesPaid?: number;
6523
+
6524
+ /**
6525
+ * Fee usage for the transaction group, including all descendant inner
6526
+ * transactions, in millionths of a basic transaction fee unit.
6527
+ */
6528
+ public groupUsage?: number;
6529
+
6335
6530
  /**
6336
6531
  * These are resources that were accessed by this group that would normally have
6337
6532
  * caused failure, but were allowed in simulation. Depending on where this object
@@ -6356,6 +6551,10 @@ export class SimulateTransactionGroupResult implements Encodable {
6356
6551
  * indicate deeper inner transactions.
6357
6552
  * @param failureMessage - If present, indicates that the transaction group failed and specifies why that
6358
6553
  * happened
6554
+ * @param groupFeesPaid - Total fees paid by the transaction group and all of its descendant inner
6555
+ * transaction groups.
6556
+ * @param groupUsage - Fee usage for the transaction group, including all descendant inner
6557
+ * transactions, in millionths of a basic transaction fee unit.
6359
6558
  * @param unnamedResourcesAccessed - These are resources that were accessed by this group that would normally have
6360
6559
  * caused failure, but were allowed in simulation. Depending on where this object
6361
6560
  * is in the response, the unnamed resources it contains may or may not qualify for
@@ -6372,6 +6571,8 @@ export class SimulateTransactionGroupResult implements Encodable {
6372
6571
  appBudgetConsumed,
6373
6572
  failedAt,
6374
6573
  failureMessage,
6574
+ groupFeesPaid,
6575
+ groupUsage,
6375
6576
  unnamedResourcesAccessed,
6376
6577
  }: {
6377
6578
  txnResults: SimulateTransactionResult[];
@@ -6379,6 +6580,8 @@ export class SimulateTransactionGroupResult implements Encodable {
6379
6580
  appBudgetConsumed?: number | bigint;
6380
6581
  failedAt?: (number | bigint)[];
6381
6582
  failureMessage?: string;
6583
+ groupFeesPaid?: number | bigint;
6584
+ groupUsage?: number | bigint;
6382
6585
  unnamedResourcesAccessed?: SimulateUnnamedResourcesAccessed;
6383
6586
  }) {
6384
6587
  this.txnResults = txnResults;
@@ -6395,6 +6598,14 @@ export class SimulateTransactionGroupResult implements Encodable {
6395
6598
  ? undefined
6396
6599
  : failedAt.map(ensureSafeInteger);
6397
6600
  this.failureMessage = failureMessage;
6601
+ this.groupFeesPaid =
6602
+ typeof groupFeesPaid === 'undefined'
6603
+ ? undefined
6604
+ : ensureSafeInteger(groupFeesPaid);
6605
+ this.groupUsage =
6606
+ typeof groupUsage === 'undefined'
6607
+ ? undefined
6608
+ : ensureSafeInteger(groupUsage);
6398
6609
  this.unnamedResourcesAccessed = unnamedResourcesAccessed;
6399
6610
  }
6400
6611
 
@@ -6410,6 +6621,8 @@ export class SimulateTransactionGroupResult implements Encodable {
6410
6621
  ['app-budget-consumed', this.appBudgetConsumed],
6411
6622
  ['failed-at', this.failedAt],
6412
6623
  ['failure-message', this.failureMessage],
6624
+ ['group-fees-paid', this.groupFeesPaid],
6625
+ ['group-usage', this.groupUsage],
6413
6626
  [
6414
6627
  'unnamed-resources-accessed',
6415
6628
  typeof this.unnamedResourcesAccessed !== 'undefined'
@@ -6433,6 +6646,8 @@ export class SimulateTransactionGroupResult implements Encodable {
6433
6646
  appBudgetConsumed: data.get('app-budget-consumed'),
6434
6647
  failedAt: data.get('failed-at'),
6435
6648
  failureMessage: data.get('failure-message'),
6649
+ groupFeesPaid: data.get('group-fees-paid'),
6650
+ groupUsage: data.get('group-usage'),
6436
6651
  unnamedResourcesAccessed:
6437
6652
  typeof data.get('unnamed-resources-accessed') !== 'undefined'
6438
6653
  ? SimulateUnnamedResourcesAccessed.fromEncodingData(
@@ -6470,6 +6685,11 @@ export class SimulateTransactionResult implements Encodable {
6470
6685
  ),
6471
6686
  omitEmpty: true,
6472
6687
  },
6688
+ {
6689
+ key: 'fees-paid',
6690
+ valueSchema: new OptionalSchema(new Uint64Schema()),
6691
+ omitEmpty: true,
6692
+ },
6473
6693
  {
6474
6694
  key: 'fixed-signer',
6475
6695
  valueSchema: new OptionalSchema(new StringSchema()),
@@ -6510,6 +6730,12 @@ export class SimulateTransactionResult implements Encodable {
6510
6730
  */
6511
6731
  public execTrace?: SimulationTransactionExecTrace;
6512
6732
 
6733
+ /**
6734
+ * Total fees paid by this transaction and all of its descendant inner
6735
+ * transactions.
6736
+ */
6737
+ public feesPaid?: number;
6738
+
6513
6739
  /**
6514
6740
  * The account that needed to sign this transaction when no signature was provided
6515
6741
  * and the provided signer was incorrect.
@@ -6542,6 +6768,8 @@ export class SimulateTransactionResult implements Encodable {
6542
6768
  * budged used by inner app calls spawned by this transaction.
6543
6769
  * @param execTrace - The execution trace of calling an app or a logic sig, containing the inner app
6544
6770
  * call trace in a recursive way.
6771
+ * @param feesPaid - Total fees paid by this transaction and all of its descendant inner
6772
+ * transactions.
6545
6773
  * @param fixedSigner - The account that needed to sign this transaction when no signature was provided
6546
6774
  * and the provided signer was incorrect.
6547
6775
  * @param logicSigBudgetConsumed - Budget used during execution of a logic sig transaction.
@@ -6559,6 +6787,7 @@ export class SimulateTransactionResult implements Encodable {
6559
6787
  txnResult,
6560
6788
  appBudgetConsumed,
6561
6789
  execTrace,
6790
+ feesPaid,
6562
6791
  fixedSigner,
6563
6792
  logicSigBudgetConsumed,
6564
6793
  unnamedResourcesAccessed,
@@ -6566,6 +6795,7 @@ export class SimulateTransactionResult implements Encodable {
6566
6795
  txnResult: PendingTransactionResponse;
6567
6796
  appBudgetConsumed?: number | bigint;
6568
6797
  execTrace?: SimulationTransactionExecTrace;
6798
+ feesPaid?: number | bigint;
6569
6799
  fixedSigner?: Address | string;
6570
6800
  logicSigBudgetConsumed?: number | bigint;
6571
6801
  unnamedResourcesAccessed?: SimulateUnnamedResourcesAccessed;
@@ -6576,6 +6806,8 @@ export class SimulateTransactionResult implements Encodable {
6576
6806
  ? undefined
6577
6807
  : ensureSafeInteger(appBudgetConsumed);
6578
6808
  this.execTrace = execTrace;
6809
+ this.feesPaid =
6810
+ typeof feesPaid === 'undefined' ? undefined : ensureSafeInteger(feesPaid);
6579
6811
  this.fixedSigner =
6580
6812
  typeof fixedSigner === 'string'
6581
6813
  ? Address.fromString(fixedSigner)
@@ -6602,6 +6834,7 @@ export class SimulateTransactionResult implements Encodable {
6602
6834
  ? this.execTrace.toEncodingData()
6603
6835
  : undefined,
6604
6836
  ],
6837
+ ['fees-paid', this.feesPaid],
6605
6838
  [
6606
6839
  'fixed-signer',
6607
6840
  typeof this.fixedSigner !== 'undefined'
@@ -6633,6 +6866,7 @@ export class SimulateTransactionResult implements Encodable {
6633
6866
  data.get('exec-trace')
6634
6867
  )
6635
6868
  : undefined,
6869
+ feesPaid: data.get('fees-paid'),
6636
6870
  fixedSigner: data.get('fixed-signer'),
6637
6871
  logicSigBudgetConsumed: data.get('logic-sig-budget-consumed'),
6638
6872
  unnamedResourcesAccessed: