near-api-js 3.0.2 → 3.0.4

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.
@@ -41607,8 +41607,14 @@ class Account {
41607
41607
  });
41608
41608
  }
41609
41609
  /**
41610
- * Sign a transaction to preform a list of actions and broadcast it using the RPC API.
41610
+ * Sign a transaction to perform a list of actions and broadcast it using the RPC API.
41611
41611
  * @see {@link "@near-js/providers".json-rpc-provider.JsonRpcProvider | JsonRpcProvider }
41612
+ *
41613
+ * @param options The options for signing and sending the transaction.
41614
+ * @param options.receiverId The NEAR account ID of the transaction receiver.
41615
+ * @param options.actions The list of actions to be performed in the transaction.
41616
+ * @param options.returnError Whether to return an error if the transaction fails.
41617
+ * @returns {Promise<FinalExecutionOutcome>} A promise that resolves to the final execution outcome of the transaction.
41612
41618
  */
41613
41619
  signAndSendTransaction({ receiverId, actions, returnError }) {
41614
41620
  return __awaiter(this, void 0, void 0, function* () {
@@ -41773,9 +41779,19 @@ class Account {
41773
41779
  return Buffer.concat([Buffer.from(contractId), Buffer.from([0]), Buffer.from(method), Buffer.from([0]), Buffer.from(args)]);
41774
41780
  }
41775
41781
  /**
41776
- * Execute function call
41777
- * @returns {Promise<FinalExecutionOutcome>}
41778
- */
41782
+ * Execute a function call.
41783
+ * @param options The options for the function call.
41784
+ * @param options.contractId The NEAR account ID of the smart contract.
41785
+ * @param options.methodName The name of the method to be called on the smart contract.
41786
+ * @param options.args The arguments to be passed to the method.
41787
+ * @param options.gas The maximum amount of gas to be used for the function call.
41788
+ * @param options.attachedDeposit The amount of NEAR tokens to be attached to the function call.
41789
+ * @param options.walletMeta Metadata for wallet integration.
41790
+ * @param options.walletCallbackUrl The callback URL for wallet integration.
41791
+ * @param options.stringify A function to convert input arguments into bytes array
41792
+ * @param options.jsContract Whether the contract is from JS SDK, automatically encodes args from JS SDK to binary.
41793
+ * @returns {Promise<FinalExecutionOutcome>} A promise that resolves to the final execution outcome of the function call.
41794
+ */
41779
41795
  functionCall({ contractId, methodName, args = {}, gas = utils_1.DEFAULT_FUNCTION_CALL_GAS, attachedDeposit, walletMeta, walletCallbackUrl, stringify, jsContract }) {
41780
41796
  return __awaiter(this, void 0, void 0, function* () {
41781
41797
  this.validateArgs(args);
@@ -41855,9 +41871,10 @@ class Account {
41855
41871
  /**
41856
41872
  * Compose and sign a SignedDelegate action to be executed in a transaction on behalf of this Account instance
41857
41873
  *
41858
- * @param actions Actions to be included in the meta transaction
41859
- * @param blockHeightTtl Number of blocks past the current block height for which the SignedDelegate action may be included in a meta transaction
41860
- * @param receiverId Receiver account of the meta transaction
41874
+ * @param options Options for the transaction.
41875
+ * @param options.actions Actions to be included in the meta transaction
41876
+ * @param options.blockHeightTtl Number of blocks past the current block height for which the SignedDelegate action may be included in a meta transaction
41877
+ * @param options.receiverId Receiver account of the meta transaction
41861
41878
  */
41862
41879
  signedDelegate({ actions, blockHeightTtl, receiverId, }) {
41863
41880
  return __awaiter(this, void 0, void 0, function* () {
@@ -41898,13 +41915,14 @@ class Account {
41898
41915
  * Invoke a contract view function using the RPC API.
41899
41916
  * @see [https://docs.near.org/api/rpc/contracts#call-a-contract-function](https://docs.near.org/api/rpc/contracts#call-a-contract-function)
41900
41917
  *
41901
- * @param viewFunctionCallOptions.contractId NEAR account where the contract is deployed
41902
- * @param viewFunctionCallOptions.methodName The view-only method (no state mutations) name on the contract as it is written in the contract code
41903
- * @param viewFunctionCallOptions.args Any arguments to the view contract method, wrapped in JSON
41904
- * @param viewFunctionCallOptions.parse Parse the result of the call. Receives a Buffer (bytes array) and converts it to any object. By default result will be treated as json.
41905
- * @param viewFunctionCallOptions.stringify Convert input arguments into a bytes array. By default the input is treated as a JSON.
41906
- * @param viewFunctionCallOptions.jsContract Is contract from JS SDK, automatically encodes args from JS SDK to binary.
41907
- * @param viewFunctionCallOptions.blockQuery specifies which block to query state at. By default returns last "optimistic" block (i.e. not necessarily finalized).
41918
+ * @param options Function call options.
41919
+ * @param options.contractId NEAR account where the contract is deployed
41920
+ * @param options.methodName The view-only method (no state mutations) name on the contract as it is written in the contract code
41921
+ * @param options.args Any arguments to the view contract method, wrapped in JSON
41922
+ * @param options.parse Parse the result of the call. Receives a Buffer (bytes array) and converts it to any object. By default result will be treated as json.
41923
+ * @param options.stringify Convert input arguments into a bytes array. By default the input is treated as a JSON.
41924
+ * @param options.jsContract Is contract from JS SDK, automatically encodes args from JS SDK to binary.
41925
+ * @param options.blockQuery specifies which block to query state at. By default returns last "optimistic" block (i.e. not necessarily finalized).
41908
41926
  * @returns {Promise<any>}
41909
41927
  */
41910
41928
  viewFunction({ contractId, methodName, args = {}, parse = parseJsonFromRawResponse, stringify = bytesJsonStringify, jsContract = false, blockQuery = { finality: 'optimistic' } }) {
@@ -42094,6 +42112,11 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42094
42112
  /**
42095
42113
  * Sign a transaction to preform a list of actions and broadcast it using the RPC API.
42096
42114
  * @see {@link "@near-js/providers".json-rpc-provider.JsonRpcProvider.sendTransaction | JsonRpcProvider.sendTransaction}
42115
+ *
42116
+ * @param options Options for the transaction.
42117
+ * @param options.receiverId The NEAR account ID of the transaction receiver.
42118
+ * @param options.actions The list of actions to be included in the transaction.
42119
+ * @returns {Promise<FinalExecutionOutcome>} A promise that resolves to the final execution outcome of the transaction.
42097
42120
  */
42098
42121
  signAndSendTransaction({ receiverId, actions }) {
42099
42122
  const _super = Object.create(null, {
@@ -42111,6 +42134,11 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42111
42134
  });
42112
42135
  }
42113
42136
  // default helpers for CH deployments of multisig
42137
+ /**
42138
+ * Deploy a multisig contract with 2FA and handle the deployment process.
42139
+ * @param contractBytes - The bytecode of the multisig contract.
42140
+ * @returns {Promise<FinalExecutionOutcome>} A promise that resolves to the final execution outcome of the deployment.
42141
+ */
42114
42142
  deployMultisig(contractBytes) {
42115
42143
  const _super = Object.create(null, {
42116
42144
  signAndSendTransactionWithAccount: { get: () => super.signAndSendTransactionWithAccount }
@@ -42147,6 +42175,13 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42147
42175
  }
42148
42176
  });
42149
42177
  }
42178
+ /**
42179
+ * Disable 2FA with the option to clean up contract state.
42180
+ * @param options Options for disabling 2FA.
42181
+ * @param options.contractBytes The bytecode of the contract to deploy.
42182
+ * @param options.cleanupContractBytes The bytecode of the cleanup contract (optional).
42183
+ * @returns {Promise<FinalExecutionOutcome>} A promise that resolves to the final execution outcome of the operation.
42184
+ */
42150
42185
  disableWithFAK({ contractBytes, cleanupContractBytes }) {
42151
42186
  return __awaiter(this, void 0, void 0, function* () {
42152
42187
  let cleanupActions = [];
@@ -42167,6 +42202,11 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42167
42202
  return this.signAndSendTransactionWithAccount(this.accountId, actions);
42168
42203
  });
42169
42204
  }
42205
+ /**
42206
+ * Retrieves cleanup actions for disabling 2FA.
42207
+ * @param cleanupContractBytes - The bytecode of the cleanup contract.
42208
+ * @returns {Promise<Action[]>} - A promise that resolves to an array of cleanup actions.
42209
+ */
42170
42210
  get2faDisableCleanupActions(cleanupContractBytes) {
42171
42211
  return __awaiter(this, void 0, void 0, function* () {
42172
42212
  const currentAccountState = yield this.viewState('').catch(error => {
@@ -42185,6 +42225,10 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42185
42225
  ] : [];
42186
42226
  });
42187
42227
  }
42228
+ /**
42229
+ * Retrieves key conversion actions for disabling 2FA.
42230
+ * @returns {Promise<Action[]>} - A promise that resolves to an array of key conversion actions.
42231
+ */
42188
42232
  get2faDisableKeyConversionActions() {
42189
42233
  return __awaiter(this, void 0, void 0, function* () {
42190
42234
  const { accountId } = this;
@@ -42208,7 +42252,8 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42208
42252
  /**
42209
42253
  * This method converts LAKs back to FAKs, clears state and deploys an 'empty' contract (contractBytes param)
42210
42254
  * @param [contractBytes]{@link https://github.com/near/near-wallet/blob/master/packages/frontend/src/wasm/main.wasm?raw=true}
42211
- * @param [cleanupContractBytes]{@link https://github.com/near/core-contracts/blob/master/state-cleanup/res/state_cleanup.wasm?raw=true}
42255
+ * @param [cleanupContractBytes]{@link https://github.com/near/core-contracts/blob/master/state-manipulation/res/state_cleanup.wasm?raw=true}
42256
+ * @returns {Promise<FinalExecutionOutcome>} A promise that resolves to the final execution outcome of the operation.
42212
42257
  */
42213
42258
  disable(contractBytes, cleanupContractBytes) {
42214
42259
  return __awaiter(this, void 0, void 0, function* () {
@@ -42236,6 +42281,10 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42236
42281
  });
42237
42282
  });
42238
42283
  }
42284
+ /**
42285
+ * Default implementation for sending the 2FA code.
42286
+ * @returns {Promise<string>} - A promise that resolves to the request ID.
42287
+ */
42239
42288
  sendCodeDefault() {
42240
42289
  return __awaiter(this, void 0, void 0, function* () {
42241
42290
  const { accountId } = this;
@@ -42254,6 +42303,10 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42254
42303
  throw new Error('There is no getCode callback provided. Please provide your own in AccountMultisig constructor options. It has a parameter method where method.kind is "email" or "phone".');
42255
42304
  });
42256
42305
  }
42306
+ /**
42307
+ * Prompts the user to enter and verify the 2FA code.
42308
+ * @returns {Promise<any>} - A promise that resolves to the verification result.
42309
+ */
42257
42310
  promptAndVerify() {
42258
42311
  return __awaiter(this, void 0, void 0, function* () {
42259
42312
  const method = yield this.get2faMethod();
@@ -42272,6 +42325,11 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42272
42325
  }
42273
42326
  });
42274
42327
  }
42328
+ /**
42329
+ * Verify the 2FA code using the default method.
42330
+ * @param securityCode - The security code to verify.
42331
+ * @returns {Promise<any>} A promise that resolves to the verification result.
42332
+ */
42275
42333
  verifyCodeDefault(securityCode) {
42276
42334
  return __awaiter(this, void 0, void 0, function* () {
42277
42335
  const { accountId } = this;
@@ -42287,6 +42345,10 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42287
42345
  });
42288
42346
  });
42289
42347
  }
42348
+ /**
42349
+ * Retrieves recovery methods for the account.
42350
+ * @returns {Promise<{ accountId: string, data: any }>} - A promise that resolves to recovery methods data.
42351
+ */
42290
42352
  getRecoveryMethods() {
42291
42353
  return __awaiter(this, void 0, void 0, function* () {
42292
42354
  const { accountId } = this;
@@ -42296,6 +42358,10 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42296
42358
  };
42297
42359
  });
42298
42360
  }
42361
+ /**
42362
+ * Gets the 2FA method (kind and detail).
42363
+ * @returns {Promise<{ kind: string, detail: string }>} A promise that resolves to the 2FA method.
42364
+ */
42299
42365
  get2faMethod() {
42300
42366
  return __awaiter(this, void 0, void 0, function* () {
42301
42367
  let { data } = yield this.getRecoveryMethods();
@@ -42308,6 +42374,10 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42308
42374
  return { kind, detail };
42309
42375
  });
42310
42376
  }
42377
+ /**
42378
+ * Generates a signature for the latest finalized block.
42379
+ * @returns {Promise<{ blockNumber: string, blockNumberSignature: string }>} - A promise that resolves to the signature information.
42380
+ */
42311
42381
  signatureFor() {
42312
42382
  return __awaiter(this, void 0, void 0, function* () {
42313
42383
  const { accountId } = this;
@@ -42318,6 +42388,12 @@ class Account2FA extends account_multisig_1.AccountMultisig {
42318
42388
  return { blockNumber, blockNumberSignature };
42319
42389
  });
42320
42390
  }
42391
+ /**
42392
+ * Sends a signed JSON request to a specified path.
42393
+ * @param path - The path for the request.
42394
+ * @param body - The request body.
42395
+ * @returns {Promise<any>} - A promise that resolves to the response from the helper.
42396
+ */
42321
42397
  postSignedJson(path, body) {
42322
42398
  return __awaiter(this, void 0, void 0, function* () {
42323
42399
  return yield (0, providers_1.fetchJson)(this.helperUrl + path, JSON.stringify(Object.assign(Object.assign({}, body), (yield this.signatureFor()))));
@@ -42420,11 +42496,25 @@ const storageFallback = {
42420
42496
  [constants_1.MULTISIG_STORAGE_KEY]: null
42421
42497
  };
42422
42498
  class AccountMultisig extends account_1.Account {
42499
+ /**
42500
+ * Constructs an instance of the `AccountMultisig` class.
42501
+ * @param connection The NEAR connection object.
42502
+ * @param accountId The NEAR account ID.
42503
+ * @param options Additional options for the multisig account.
42504
+ * @param options.storage Storage to store data related to multisig operations.
42505
+ * @param options.onAddRequestResult Callback function to handle the result of adding a request.
42506
+ */
42423
42507
  constructor(connection, accountId, options) {
42424
42508
  super(connection, accountId);
42425
42509
  this.storage = options.storage;
42426
42510
  this.onAddRequestResult = options.onAddRequestResult;
42427
42511
  }
42512
+ /**
42513
+ * Sign and send a transaction with the multisig account as the sender.
42514
+ * @param receiverId - The NEAR account ID of the transaction receiver.
42515
+ * @param actions - The list of actions to be included in the transaction.
42516
+ * @returns {Promise<FinalExecutionOutcome>} A promise that resolves to the final execution outcome of the transaction.
42517
+ */
42428
42518
  signAndSendTransactionWithAccount(receiverId, actions) {
42429
42519
  const _super = Object.create(null, {
42430
42520
  signAndSendTransaction: { get: () => super.signAndSendTransaction }
@@ -42433,6 +42523,13 @@ class AccountMultisig extends account_1.Account {
42433
42523
  return _super.signAndSendTransaction.call(this, { receiverId, actions });
42434
42524
  });
42435
42525
  }
42526
+ /**
42527
+ * Sign and send a multisig transaction to add a request and confirm it.
42528
+ * @param options Options for the multisig transaction.
42529
+ * @param options.receiverId The NEAR account ID of the transaction receiver.
42530
+ * @param options.actions The list of actions to be included in the transaction.
42531
+ * @returns {Promise<FinalExecutionOutcome>} A promise that resolves to the final execution outcome of the transaction.
42532
+ */
42436
42533
  signAndSendTransaction({ receiverId, actions }) {
42437
42534
  const _super = Object.create(null, {
42438
42535
  signAndSendTransaction: { get: () => super.signAndSendTransaction }
@@ -42482,10 +42579,12 @@ class AccountMultisig extends account_1.Account {
42482
42579
  return result;
42483
42580
  });
42484
42581
  }
42485
- /*
42582
+ /**
42486
42583
  * This method submits a canary transaction that is expected to always fail in order to determine whether the contract currently has valid multisig state
42487
42584
  * and whether it is initialized. The canary transaction attempts to delete a request at index u32_max and will go through if a request exists at that index.
42488
42585
  * a u32_max + 1 and -1 value cannot be used for the canary due to expected u32 error thrown before deserialization attempt.
42586
+ * @param contractBytes The bytecode of the multisig contract.
42587
+ * @returns {Promise<{ codeStatus: MultisigCodeStatus; stateStatus: MultisigStateStatus }>} A promise that resolves to the status of the code and state.
42489
42588
  */
42490
42589
  checkMultisigCodeAndStateStatus(contractBytes) {
42491
42590
  const _super = Object.create(null, {
@@ -42526,12 +42625,21 @@ class AccountMultisig extends account_1.Account {
42526
42625
  }
42527
42626
  });
42528
42627
  }
42628
+ /**
42629
+ * Delete a multisig request by its ID.
42630
+ * @param request_id The ID of the multisig request to be deleted.
42631
+ * @returns {Promise<FinalExecutionOutcome>} A promise that resolves to the final execution outcome of the deletion.
42632
+ */
42529
42633
  deleteRequest(request_id) {
42530
42634
  return super.signAndSendTransaction({
42531
42635
  receiverId: this.accountId,
42532
42636
  actions: [functionCall('delete_request', { request_id }, constants_1.MULTISIG_GAS, constants_1.MULTISIG_DEPOSIT)]
42533
42637
  });
42534
42638
  }
42639
+ /**
42640
+ * Delete all multisig requests associated with the account.
42641
+ * @returns {Promise<void>} A promise that resolves when all requests are deleted.
42642
+ */
42535
42643
  deleteAllRequests() {
42536
42644
  return __awaiter(this, void 0, void 0, function* () {
42537
42645
  const request_ids = yield this.getRequestIds();
@@ -42540,6 +42648,10 @@ class AccountMultisig extends account_1.Account {
42540
42648
  }
42541
42649
  });
42542
42650
  }
42651
+ /**
42652
+ * Delete unconfirmed multisig requests associated with the account.
42653
+ * @returns {Promise<void>} A promise that resolves when unconfirmed requests are deleted.
42654
+ */
42543
42655
  deleteUnconfirmedRequests() {
42544
42656
  const _super = Object.create(null, {
42545
42657
  signAndSendTransaction: { get: () => super.signAndSendTransaction }
@@ -43049,6 +43161,15 @@ class LocalViewExecution {
43049
43161
  return fetched;
43050
43162
  });
43051
43163
  }
43164
+ /**
43165
+ * Calls a view function on a contract, fetching the contract code and state if needed.
43166
+ * @param options Options for calling the view function.
43167
+ * @param options.contractId The contract account ID.
43168
+ * @param options.methodName The name of the view function to call.
43169
+ * @param options.args The arguments to pass to the view function.
43170
+ * @param options.blockQuery The block query options.
43171
+ * @returns {Promise<any>} - A promise that resolves to the result of the view function.
43172
+ */
43052
43173
  viewFunction(_a) {
43053
43174
  var { contractId, methodName, args = {}, blockQuery = { finality: 'optimistic' } } = _a, ignored = __rest(_a, ["contractId", "methodName", "args", "blockQuery"]);
43054
43175
  return __awaiter(this, void 0, void 0, function* () {
@@ -43518,6 +43639,11 @@ class KeyPair extends key_pair_base_1.KeyPairBase {
43518
43639
  default: throw new Error(`Unknown curve ${curve}`);
43519
43640
  }
43520
43641
  }
43642
+ /**
43643
+ * Creates a key pair from an encoded key string.
43644
+ * @param encodedKey The encoded key string.
43645
+ * @returns {KeyPair} The key pair created from the encoded key string.
43646
+ */
43521
43647
  static fromString(encodedKey) {
43522
43648
  const parts = encodedKey.split(':');
43523
43649
  if (parts.length === 1) {
@@ -43565,7 +43691,7 @@ class KeyPairEd25519 extends key_pair_base_1.KeyPairBase {
43565
43691
  /**
43566
43692
  * Construct an instance of key pair given a secret key.
43567
43693
  * It's generally assumed that these are encoded in base58.
43568
- * @param {string} extendedSecretKey
43694
+ * @param extendedSecretKey
43569
43695
  */
43570
43696
  constructor(extendedSecretKey) {
43571
43697
  super();
@@ -43588,20 +43714,39 @@ class KeyPairEd25519 extends key_pair_base_1.KeyPairBase {
43588
43714
  */
43589
43715
  static fromRandom() {
43590
43716
  const secretKey = (0, randombytes_1.default)(constants_1.KeySize.SECRET_KEY);
43591
- const publicKey = ed25519_1.ed25519.getPublicKey(secretKey);
43717
+ const publicKey = ed25519_1.ed25519.getPublicKey(new Uint8Array(secretKey));
43592
43718
  const extendedSecretKey = new Uint8Array([...secretKey, ...publicKey]);
43593
43719
  return new KeyPairEd25519((0, utils_1.baseEncode)(extendedSecretKey));
43594
43720
  }
43721
+ /**
43722
+ * Signs a message using the key pair's secret key.
43723
+ * @param message The message to be signed.
43724
+ * @returns {Signature} The signature object containing the signature and the public key.
43725
+ */
43595
43726
  sign(message) {
43596
43727
  const signature = ed25519_1.ed25519.sign(message, (0, utils_1.baseDecode)(this.secretKey));
43597
43728
  return { signature, publicKey: this.publicKey };
43598
43729
  }
43730
+ /**
43731
+ * Verifies the signature of a message using the key pair's public key.
43732
+ * @param message The message to be verified.
43733
+ * @param signature The signature to be verified.
43734
+ * @returns {boolean} `true` if the signature is valid, otherwise `false`.
43735
+ */
43599
43736
  verify(message, signature) {
43600
43737
  return this.publicKey.verify(message, signature);
43601
43738
  }
43739
+ /**
43740
+ * Returns a string representation of the key pair in the format 'ed25519:[extendedSecretKey]'.
43741
+ * @returns {string} The string representation of the key pair.
43742
+ */
43602
43743
  toString() {
43603
43744
  return `ed25519:${this.extendedSecretKey}`;
43604
43745
  }
43746
+ /**
43747
+ * Retrieves the public key associated with the key pair.
43748
+ * @returns {PublicKey} The public key.
43749
+ */
43605
43750
  getPublicKey() {
43606
43751
  return this.publicKey;
43607
43752
  }
@@ -43632,12 +43777,22 @@ function str_to_key_type(keyType) {
43632
43777
  * PublicKey representation that has type and bytes of the key.
43633
43778
  */
43634
43779
  class PublicKey extends types_1.Assignable {
43780
+ /**
43781
+ * Creates a PublicKey instance from a string or an existing PublicKey instance.
43782
+ * @param value The string or PublicKey instance to create a PublicKey from.
43783
+ * @returns {PublicKey} The PublicKey instance.
43784
+ */
43635
43785
  static from(value) {
43636
43786
  if (typeof value === 'string') {
43637
43787
  return PublicKey.fromString(value);
43638
43788
  }
43639
43789
  return value;
43640
43790
  }
43791
+ /**
43792
+ * Creates a PublicKey instance from an encoded key string.
43793
+ * @param encodedKey The encoded key string.
43794
+ * @returns {PublicKey} The PublicKey instance created from the encoded key string.
43795
+ */
43641
43796
  static fromString(encodedKey) {
43642
43797
  const parts = encodedKey.split(':');
43643
43798
  let publicKey;
@@ -43658,9 +43813,19 @@ class PublicKey extends types_1.Assignable {
43658
43813
  }
43659
43814
  return new PublicKey({ keyType, data: decodedPublicKey });
43660
43815
  }
43816
+ /**
43817
+ * Returns a string representation of the public key.
43818
+ * @returns {string} The string representation of the public key.
43819
+ */
43661
43820
  toString() {
43662
43821
  return `${key_type_to_str(this.keyType)}:${(0, utils_1.baseEncode)(this.data)}`;
43663
43822
  }
43823
+ /**
43824
+ * Verifies a message signature using the public key.
43825
+ * @param message The message to be verified.
43826
+ * @param signature The signature to be verified.
43827
+ * @returns {boolean} `true` if the signature is valid, otherwise `false`.
43828
+ */
43664
43829
  verify(message, signature) {
43665
43830
  switch (this.keyType) {
43666
43831
  case constants_1.KeyType.ED25519: return ed25519_1.ed25519.verify(signature, message, this.data);
@@ -43804,7 +43969,7 @@ class BrowserLocalStorageKeyStore extends keystores_1.KeyStore {
43804
43969
  * @hidden
43805
43970
  * Helper function to retrieve a local storage key
43806
43971
  * @param networkId The targeted network. (ex. default, betanet, etc…)
43807
- * @param accountId The NEAR account tied to the storage keythat's sought
43972
+ * @param accountId The NEAR account tied to the storage key that's sought
43808
43973
  * @returns {string} An example might be: `near-api-js:keystore:near-friend:default`
43809
43974
  */
43810
43975
  storageKeyForSecretKey(networkId, accountId) {
@@ -43995,6 +44160,7 @@ const keystore_1 = require("./keystore");
43995
44160
  class MergeKeyStore extends keystore_1.KeyStore {
43996
44161
  /**
43997
44162
  * @param keyStores read calls are attempted from start to end of array
44163
+ * @param options KeyStore options
43998
44164
  * @param options.writeKeyStoreIndex the keystore index that will receive all write calls
43999
44165
  */
44000
44166
  constructor(keyStores, options = { writeKeyStoreIndex: 0 }) {
@@ -44684,6 +44850,12 @@ const exponential_backoff_1 = require("./exponential-backoff");
44684
44850
  const START_WAIT_TIME_MS = 1000;
44685
44851
  const BACKOFF_MULTIPLIER = 1.5;
44686
44852
  const RETRY_NUMBER = 10;
44853
+ /**
44854
+ * Performs an HTTP request to a specified URL or connection and returns the parsed JSON response.
44855
+ * @param connectionInfoOrUrl The connection information or URL for the HTTP request.
44856
+ * @param json The JSON payload to be included in the request body for POST requests.
44857
+ * @returns A Promise that resolves to the parsed JSON response from the HTTP request.
44858
+ */
44687
44859
  function fetchJson(connectionInfoOrUrl, json) {
44688
44860
  return __awaiter(this, void 0, void 0, function* () {
44689
44861
  let connectionInfo = { url: null };
@@ -45095,6 +45267,7 @@ class JsonRpcProvider extends provider_1.Provider {
45095
45267
  sendJsonRpc(method, params) {
45096
45268
  return __awaiter(this, void 0, void 0, function* () {
45097
45269
  const response = yield (0, exponential_backoff_1.exponentialBackoff)(REQUEST_RETRY_WAIT, REQUEST_RETRY_NUMBER, REQUEST_RETRY_WAIT_BACKOFF, () => __awaiter(this, void 0, void 0, function* () {
45270
+ var _a;
45098
45271
  try {
45099
45272
  const request = {
45100
45273
  method,
@@ -45119,7 +45292,17 @@ class JsonRpcProvider extends provider_1.Provider {
45119
45292
  || errorMessage.includes('query has timed out')) {
45120
45293
  throw new types_1.TypedError(errorMessage, 'TimeoutError');
45121
45294
  }
45122
- throw new types_1.TypedError(errorMessage, (0, utils_1.getErrorTypeFromErrorMessage)(response.error.data, response.error.name));
45295
+ const errorType = (0, utils_1.getErrorTypeFromErrorMessage)(response.error.data, '');
45296
+ if (errorType) {
45297
+ throw new types_1.TypedError((0, utils_1.formatError)(errorType, params), errorType);
45298
+ }
45299
+ throw new types_1.TypedError(errorMessage, response.error.name);
45300
+ }
45301
+ }
45302
+ else if (typeof ((_a = response.result) === null || _a === void 0 ? void 0 : _a.error) === 'string') {
45303
+ const errorType = (0, utils_1.getErrorTypeFromErrorMessage)(response.result.error, '');
45304
+ if (errorType) {
45305
+ throw new utils_1.ServerError((0, utils_1.formatError)(errorType, params), errorType);
45123
45306
  }
45124
45307
  }
45125
45308
  // Success when response.error is not exist
@@ -45285,6 +45468,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
45285
45468
  exports.actionCreators = exports.stringifyJsonOrBytes = void 0;
45286
45469
  const bn_js_1 = __importDefault(require("bn.js"));
45287
45470
  const actions_1 = require("./actions");
45471
+ /**
45472
+ * Creates a full access key with full access permissions.
45473
+ * @returns A new full access key.
45474
+ */
45288
45475
  function fullAccessKey() {
45289
45476
  return new actions_1.AccessKey({
45290
45477
  nonce: 0,
@@ -45293,6 +45480,13 @@ function fullAccessKey() {
45293
45480
  })
45294
45481
  });
45295
45482
  }
45483
+ /**
45484
+ * Creates an access key with function call permission for a specific receiver and method names.
45485
+ * @param receiverId The NEAR account ID of the function call receiver.
45486
+ * @param methodNames An array of method names allowed for function calls.
45487
+ * @param allowance An optional allowance (maximum amount) for the function call. Default: Unlimited.
45488
+ * @returns A new access key with function call permission.
45489
+ */
45296
45490
  function functionCallAccessKey(receiverId, methodNames, allowance) {
45297
45491
  return new actions_1.AccessKey({
45298
45492
  nonce: 0,
@@ -45301,12 +45495,26 @@ function functionCallAccessKey(receiverId, methodNames, allowance) {
45301
45495
  })
45302
45496
  });
45303
45497
  }
45498
+ /**
45499
+ * Creates a new action for creating a new NEAR account.
45500
+ * @returns A new action for creating a new account.
45501
+ */
45304
45502
  function createAccount() {
45305
45503
  return new actions_1.Action({ createAccount: new actions_1.CreateAccount({}) });
45306
45504
  }
45505
+ /**
45506
+ * Creates a new action for deploying a contract with the provided code.
45507
+ * @param code The Uint8Array representing the code of the contract.
45508
+ * @returns A new action for deploying a contract.
45509
+ */
45307
45510
  function deployContract(code) {
45308
45511
  return new actions_1.Action({ deployContract: new actions_1.DeployContract({ code }) });
45309
45512
  }
45513
+ /**
45514
+ * Converts an input argument to a Buffer, handling cases for both JSON and Uint8Array.
45515
+ * @param args The input argument, either JSON object or Uint8Array.
45516
+ * @returns A Buffer representation of the input argument.
45517
+ */
45310
45518
  function stringifyJsonOrBytes(args) {
45311
45519
  const isUint8Array = args.byteLength !== undefined && args.byteLength === args.length;
45312
45520
  return isUint8Array ? args : Buffer.from(JSON.stringify(args));
@@ -45336,21 +45544,54 @@ function functionCall(methodName, args, gas = new bn_js_1.default(0), deposit =
45336
45544
  }),
45337
45545
  });
45338
45546
  }
45547
+ /**
45548
+ * Creates a new action for transferring funds, optionally specifying a deposit amount.
45549
+ * @param deposit The amount to be deposited along with the transfer. Default: 0.
45550
+ * @returns A new action for transferring funds.
45551
+ */
45339
45552
  function transfer(deposit = new bn_js_1.default(0)) {
45340
45553
  return new actions_1.Action({ transfer: new actions_1.Transfer({ deposit }) });
45341
45554
  }
45555
+ /**
45556
+ * Creates a new action for staking tokens, specifying the stake amount and public key.
45557
+ * @param stake The amount to be staked. Default: 0.
45558
+ * @param publicKey The public key associated with the staking action.
45559
+ * @returns A new action for staking tokens.
45560
+ */
45342
45561
  function stake(stake = new bn_js_1.default(0), publicKey) {
45343
45562
  return new actions_1.Action({ stake: new actions_1.Stake({ stake, publicKey }) });
45344
45563
  }
45564
+ /**
45565
+ * Creates a new action for adding a public key with a specified access key.
45566
+ * @param publicKey The public key to be added.
45567
+ * @param accessKey The access key associated with the added public key.
45568
+ * @returns A new action for adding a public key.
45569
+ */
45345
45570
  function addKey(publicKey, accessKey) {
45346
45571
  return new actions_1.Action({ addKey: new actions_1.AddKey({ publicKey, accessKey }) });
45347
45572
  }
45573
+ /**
45574
+ * Creates a new action for deleting a public key.
45575
+ * @param publicKey The public key to be deleted.
45576
+ * @returns A new action for deleting a public key.
45577
+ */
45348
45578
  function deleteKey(publicKey) {
45349
45579
  return new actions_1.Action({ deleteKey: new actions_1.DeleteKey({ publicKey }) });
45350
45580
  }
45581
+ /**
45582
+ * Creates a new action for deleting an account with the specified beneficiary ID.
45583
+ * @param beneficiaryId The NEAR account ID of the beneficiary.
45584
+ * @returns A new action for deleting an account.
45585
+ */
45351
45586
  function deleteAccount(beneficiaryId) {
45352
45587
  return new actions_1.Action({ deleteAccount: new actions_1.DeleteAccount({ beneficiaryId }) });
45353
45588
  }
45589
+ /**
45590
+ * Creates a new action for a signed delegation, specifying the delegate action and signature.
45591
+ * @param delegateAction The delegate action to be performed.
45592
+ * @param signature The signature associated with the delegate action.
45593
+ * @returns A new action for a signed delegation.
45594
+ */
45354
45595
  function signedDelegate({ delegateAction, signature }) {
45355
45596
  return new actions_1.Action({ signedDelegate: new actions_1.SignedDelegate({ delegateAction, signature }) });
45356
45597
  }
@@ -45444,6 +45685,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
45444
45685
  exports.createTransaction = void 0;
45445
45686
  const bn_js_1 = __importDefault(require("bn.js"));
45446
45687
  const schema_1 = require("./schema");
45688
+ /**
45689
+ * Creates a new transaction object with the provided parameters.
45690
+ * @param signerId The NEAR account ID of the transaction signer.
45691
+ * @param publicKey The public key associated with the signer.
45692
+ * @param receiverId The NEAR account ID of the transaction receiver.
45693
+ * @param nonce The nonce value for the transaction, represented as a BN, string, or number.
45694
+ * @param actions An array of transaction actions to be performed.
45695
+ * @param blockHash The hash of the block where the transaction will be included.
45696
+ * @returns A new transaction object initialized with the provided parameters.
45697
+ */
45447
45698
  function createTransaction(signerId, publicKey, receiverId, nonce, actions, blockHash) {
45448
45699
  return new schema_1.Transaction({ signerId, publicKey, nonce: new bn_js_1.default(nonce), receiverId, actions, blockHash });
45449
45700
  }
@@ -45461,12 +45712,12 @@ class DelegateAction extends types_1.Assignable {
45461
45712
  exports.DelegateAction = DelegateAction;
45462
45713
  /**
45463
45714
  * Compose a delegate action for inclusion with a meta transaction signed on the sender's behalf
45464
- * @params.actions The set of actions to be included in the meta transaction
45465
- * @params.maxBlockHeight The maximum block height for which this action can be executed as part of a transaction
45466
- * @params.nonce Current nonce on the access key used to sign the delegate action
45467
- * @params.publicKey Public key for the access key used to sign the delegate action
45468
- * @params.receiverId Account ID for the intended receiver of the meta transaction
45469
- * @params.senderId Account ID for the intended signer of the delegate action
45715
+ * @param actions The set of actions to be included in the meta transaction
45716
+ * @param maxBlockHeight The maximum block height for which this action can be executed as part of a transaction
45717
+ * @param nonce Current nonce on the access key used to sign the delegate action
45718
+ * @param publicKey Public key for the access key used to sign the delegate action
45719
+ * @param receiverId Account ID for the intended receiver of the meta transaction
45720
+ * @param senderId Account ID for the intended signer of the delegate action
45470
45721
  */
45471
45722
  function buildDelegateAction({ actions, maxBlockHeight, nonce, publicKey, receiverId, senderId, }) {
45472
45723
  return new DelegateAction({
@@ -45614,6 +45865,11 @@ function encodeSignedDelegate(signedDelegate) {
45614
45865
  return (0, borsh_1.serialize)(exports.SCHEMA.SignedDelegate, signedDelegate);
45615
45866
  }
45616
45867
  exports.encodeSignedDelegate = encodeSignedDelegate;
45868
+ /**
45869
+ * Borsh-encode a transaction or signed transaction into a serialized form.
45870
+ * @param transaction The transaction or signed transaction object to be encoded.
45871
+ * @returns A serialized representation of the input transaction.
45872
+ */
45617
45873
  function encodeTransaction(transaction) {
45618
45874
  const schema = transaction instanceof SignedTransaction ? exports.SCHEMA.SignedTransaction : exports.SCHEMA.Transaction;
45619
45875
  return (0, borsh_1.serialize)(schema, transaction);
@@ -45753,8 +46009,8 @@ exports.SCHEMA = new class BorshSchema {
45753
46009
  struct: {
45754
46010
  senderId: 'string',
45755
46011
  receiverId: 'string',
45756
- nonce: 'u64',
45757
46012
  actions: { array: { type: this.ClassicActions } },
46013
+ nonce: 'u64',
45758
46014
  maxBlockHeight: 'u64',
45759
46015
  publicKey: this.PublicKey,
45760
46016
  }
@@ -45851,8 +46107,9 @@ function signTransaction(...args) {
45851
46107
  exports.signTransaction = signTransaction;
45852
46108
  /**
45853
46109
  * Sign a delegate action
45854
- * @params.delegateAction Delegate action to be signed by the meta transaction sender
45855
- * @params.signer Signer instance for the meta transaction sender
46110
+ * @options SignDelegate options
46111
+ * @param options.delegateAction Delegate action to be signed by the meta transaction sender
46112
+ * @param options.signer Signer instance for the meta transaction sender
45856
46113
  */
45857
46114
  function signDelegateAction({ delegateAction, signer }) {
45858
46115
  return __awaiter(this, void 0, void 0, function* () {
@@ -46067,6 +46324,7 @@ module.exports={
46067
46324
  "AccountAlreadyExists": "Can't create a new account {{account_id}}, because it already exists",
46068
46325
  "InvalidChain": "Transaction parent block hash doesn't belong to the current chain",
46069
46326
  "AccountDoesNotExist": "Can't complete the action because account {{account_id}} doesn't exist",
46327
+ "AccessKeyDoesNotExist": "Can't complete the action because access key {{public_key}} doesn't exist",
46070
46328
  "MethodNameMismatch": "Transaction method name {{method_name}} isn't allowed by the access key",
46071
46329
  "DeleteAccountHasRent": "Account {{account_id}} can't be deleted. It has {{#formatNear}}{{balance}}{{/formatNear}}, which is enough to cover the rent",
46072
46330
  "DeleteAccountHasEnoughBalance": "Account {{account_id}} can't be deleted. It has {{#formatNear}}{{balance}}{{/formatNear}}, which is enough to cover it's storage",
@@ -46083,8 +46341,8 @@ exports.logWarning = void 0;
46083
46341
  const logger_1 = require("../logger");
46084
46342
  /** @deprecated */
46085
46343
  function logWarning(...args) {
46086
- const [message, ...optinalParams] = args;
46087
- logger_1.Logger.warn(message, ...optinalParams);
46344
+ const [message, ...optionalParams] = args;
46345
+ logger_1.Logger.warn(message, ...optionalParams);
46088
46346
  }
46089
46347
  exports.logWarning = logWarning;
46090
46348
 
@@ -46104,6 +46362,117 @@ Object.defineProperty(exports, "parseRpcError", { enumerable: true, get: functio
46104
46362
  },{"./errors":361,"./rpc_errors":364}],363:[function(require,module,exports){
46105
46363
  module.exports={
46106
46364
  "schema": {
46365
+ "AccessKeyNotFound": {
46366
+ "name": "AccessKeyNotFound",
46367
+ "subtypes": [],
46368
+ "props": {
46369
+ "account_id": "",
46370
+ "public_key": ""
46371
+ }
46372
+ },
46373
+ "AccountAlreadyExists": {
46374
+ "name": "AccountAlreadyExists",
46375
+ "subtypes": [],
46376
+ "props": {
46377
+ "account_id": ""
46378
+ }
46379
+ },
46380
+ "AccountDoesNotExist": {
46381
+ "name": "AccountDoesNotExist",
46382
+ "subtypes": [],
46383
+ "props": {
46384
+ "account_id": ""
46385
+ }
46386
+ },
46387
+ "ActionError": {
46388
+ "name": "ActionError",
46389
+ "subtypes": [
46390
+ "AccountAlreadyExists",
46391
+ "AccountDoesNotExist",
46392
+ "CreateAccountOnlyByRegistrar",
46393
+ "CreateAccountNotAllowed",
46394
+ "ActorNoPermission",
46395
+ "DeleteKeyDoesNotExist",
46396
+ "AddKeyAlreadyExists",
46397
+ "DeleteAccountStaking",
46398
+ "LackBalanceForState",
46399
+ "TriesToUnstake",
46400
+ "TriesToStake",
46401
+ "InsufficientStake",
46402
+ "FunctionCallError",
46403
+ "NewReceiptValidationError",
46404
+ "OnlyImplicitAccountCreationAllowed",
46405
+ "DeleteAccountWithLargeState",
46406
+ "DelegateActionInvalidSignature",
46407
+ "DelegateActionSenderDoesNotMatchTxReceiver",
46408
+ "DelegateActionExpired",
46409
+ "DelegateActionAccessKeyError",
46410
+ "DelegateActionInvalidNonce",
46411
+ "DelegateActionNonceTooLarge"
46412
+ ],
46413
+ "props": {
46414
+ "index": ""
46415
+ }
46416
+ },
46417
+ "ActionsValidationError": {
46418
+ "name": "ActionsValidationError",
46419
+ "subtypes": [
46420
+ "DeleteActionMustBeFinal",
46421
+ "TotalPrepaidGasExceeded",
46422
+ "TotalNumberOfActionsExceeded",
46423
+ "AddKeyMethodNamesNumberOfBytesExceeded",
46424
+ "AddKeyMethodNameLengthExceeded",
46425
+ "IntegerOverflow",
46426
+ "InvalidAccountId",
46427
+ "ContractSizeExceeded",
46428
+ "FunctionCallMethodNameLengthExceeded",
46429
+ "FunctionCallArgumentsLengthExceeded",
46430
+ "UnsuitableStakingKey",
46431
+ "FunctionCallZeroAttachedGas",
46432
+ "DelegateActionMustBeOnlyOne",
46433
+ "UnsupportedProtocolFeature"
46434
+ ],
46435
+ "props": {}
46436
+ },
46437
+ "ActorNoPermission": {
46438
+ "name": "ActorNoPermission",
46439
+ "subtypes": [],
46440
+ "props": {
46441
+ "account_id": "",
46442
+ "actor_id": ""
46443
+ }
46444
+ },
46445
+ "AddKeyAlreadyExists": {
46446
+ "name": "AddKeyAlreadyExists",
46447
+ "subtypes": [],
46448
+ "props": {
46449
+ "account_id": "",
46450
+ "public_key": ""
46451
+ }
46452
+ },
46453
+ "AddKeyMethodNameLengthExceeded": {
46454
+ "name": "AddKeyMethodNameLengthExceeded",
46455
+ "subtypes": [],
46456
+ "props": {
46457
+ "length": "",
46458
+ "limit": ""
46459
+ }
46460
+ },
46461
+ "AddKeyMethodNamesNumberOfBytesExceeded": {
46462
+ "name": "AddKeyMethodNamesNumberOfBytesExceeded",
46463
+ "subtypes": [],
46464
+ "props": {
46465
+ "limit": "",
46466
+ "total_number_of_bytes": ""
46467
+ }
46468
+ },
46469
+ "AltBn128InvalidInput": {
46470
+ "name": "AltBn128InvalidInput",
46471
+ "subtypes": [],
46472
+ "props": {
46473
+ "msg": ""
46474
+ }
46475
+ },
46107
46476
  "BadUTF16": {
46108
46477
  "name": "BadUTF16",
46109
46478
  "subtypes": [],
@@ -46119,20 +46488,23 @@ module.exports={
46119
46488
  "subtypes": [],
46120
46489
  "props": {}
46121
46490
  },
46122
- "BreakpointTrap": {
46123
- "name": "BreakpointTrap",
46491
+ "BalanceMismatchError": {
46492
+ "name": "BalanceMismatchError",
46124
46493
  "subtypes": [],
46125
- "props": {}
46126
- },
46127
- "CacheError": {
46128
- "name": "CacheError",
46129
- "subtypes": [
46130
- "ReadError",
46131
- "WriteError",
46132
- "DeserializationError",
46133
- "SerializationError"
46134
- ],
46135
- "props": {}
46494
+ "props": {
46495
+ "final_accounts_balance": "",
46496
+ "final_postponed_receipts_balance": "",
46497
+ "incoming_receipts_balance": "",
46498
+ "incoming_validator_rewards": "",
46499
+ "initial_accounts_balance": "",
46500
+ "initial_postponed_receipts_balance": "",
46501
+ "new_delayed_receipts_balance": "",
46502
+ "other_burnt_amount": "",
46503
+ "outgoing_receipts_balance": "",
46504
+ "processed_delayed_receipts_balance": "",
46505
+ "slashed_burnt_amount": "",
46506
+ "tx_burnt_amount": ""
46507
+ }
46136
46508
  },
46137
46509
  "CallIndirectOOB": {
46138
46510
  "name": "CallIndirectOOB",
@@ -46173,567 +46545,239 @@ module.exports={
46173
46545
  "size": ""
46174
46546
  }
46175
46547
  },
46176
- "Deprecated": {
46177
- "name": "Deprecated",
46548
+ "CostOverflow": {
46549
+ "name": "CostOverflow",
46550
+ "subtypes": [],
46551
+ "props": {}
46552
+ },
46553
+ "CreateAccountNotAllowed": {
46554
+ "name": "CreateAccountNotAllowed",
46178
46555
  "subtypes": [],
46179
46556
  "props": {
46180
- "method_name": ""
46557
+ "account_id": "",
46558
+ "predecessor_id": ""
46181
46559
  }
46182
46560
  },
46183
- "Deserialization": {
46184
- "name": "Deserialization",
46561
+ "CreateAccountOnlyByRegistrar": {
46562
+ "name": "CreateAccountOnlyByRegistrar",
46185
46563
  "subtypes": [],
46186
- "props": {}
46564
+ "props": {
46565
+ "account_id": "",
46566
+ "predecessor_id": "",
46567
+ "registrar_account_id": ""
46568
+ }
46187
46569
  },
46188
- "DeserializationError": {
46189
- "name": "DeserializationError",
46570
+ "DelegateActionExpired": {
46571
+ "name": "DelegateActionExpired",
46190
46572
  "subtypes": [],
46191
46573
  "props": {}
46192
46574
  },
46193
- "EmptyMethodName": {
46194
- "name": "EmptyMethodName",
46575
+ "DelegateActionInvalidNonce": {
46576
+ "name": "DelegateActionInvalidNonce",
46195
46577
  "subtypes": [],
46196
- "props": {}
46197
- },
46198
- "FunctionCallError": {
46199
- "name": "FunctionCallError",
46200
- "subtypes": [
46201
- "CompilationError",
46202
- "LinkError",
46203
- "MethodResolveError",
46204
- "WasmTrap",
46205
- "WasmUnknownError",
46206
- "HostError",
46207
- "EvmError"
46208
- ],
46209
- "props": {}
46578
+ "props": {
46579
+ "ak_nonce": "",
46580
+ "delegate_nonce": ""
46581
+ }
46210
46582
  },
46211
- "GasExceeded": {
46212
- "name": "GasExceeded",
46583
+ "DelegateActionInvalidSignature": {
46584
+ "name": "DelegateActionInvalidSignature",
46213
46585
  "subtypes": [],
46214
46586
  "props": {}
46215
46587
  },
46216
- "GasInstrumentation": {
46217
- "name": "GasInstrumentation",
46588
+ "DelegateActionMustBeOnlyOne": {
46589
+ "name": "DelegateActionMustBeOnlyOne",
46218
46590
  "subtypes": [],
46219
46591
  "props": {}
46220
46592
  },
46221
- "GasLimitExceeded": {
46222
- "name": "GasLimitExceeded",
46593
+ "DelegateActionNonceTooLarge": {
46594
+ "name": "DelegateActionNonceTooLarge",
46223
46595
  "subtypes": [],
46224
- "props": {}
46596
+ "props": {
46597
+ "delegate_nonce": "",
46598
+ "upper_bound": ""
46599
+ }
46225
46600
  },
46226
- "GenericTrap": {
46227
- "name": "GenericTrap",
46228
- "subtypes": [],
46229
- "props": {}
46230
- },
46231
- "GuestPanic": {
46232
- "name": "GuestPanic",
46601
+ "DelegateActionSenderDoesNotMatchTxReceiver": {
46602
+ "name": "DelegateActionSenderDoesNotMatchTxReceiver",
46233
46603
  "subtypes": [],
46234
46604
  "props": {
46235
- "panic_msg": ""
46605
+ "receiver_id": "",
46606
+ "sender_id": ""
46236
46607
  }
46237
46608
  },
46238
- "HostError": {
46239
- "name": "HostError",
46240
- "subtypes": [
46241
- "BadUTF16",
46242
- "BadUTF8",
46243
- "GasExceeded",
46244
- "GasLimitExceeded",
46245
- "BalanceExceeded",
46246
- "EmptyMethodName",
46247
- "GuestPanic",
46248
- "IntegerOverflow",
46249
- "InvalidPromiseIndex",
46250
- "CannotAppendActionToJointPromise",
46251
- "CannotReturnJointPromise",
46252
- "InvalidPromiseResultIndex",
46253
- "InvalidRegisterId",
46254
- "IteratorWasInvalidated",
46255
- "MemoryAccessViolation",
46256
- "InvalidReceiptIndex",
46257
- "InvalidIteratorIndex",
46258
- "InvalidAccountId",
46259
- "InvalidMethodName",
46260
- "InvalidPublicKey",
46261
- "ProhibitedInView",
46262
- "NumberOfLogsExceeded",
46263
- "KeyLengthExceeded",
46264
- "ValueLengthExceeded",
46265
- "TotalLogLengthExceeded",
46266
- "NumberPromisesExceeded",
46267
- "NumberInputDataDependenciesExceeded",
46268
- "ReturnedValueLengthExceeded",
46269
- "ContractSizeExceeded",
46270
- "Deprecated"
46271
- ],
46272
- "props": {}
46273
- },
46274
- "IllegalArithmetic": {
46275
- "name": "IllegalArithmetic",
46276
- "subtypes": [],
46277
- "props": {}
46278
- },
46279
- "IncorrectCallIndirectSignature": {
46280
- "name": "IncorrectCallIndirectSignature",
46281
- "subtypes": [],
46282
- "props": {}
46283
- },
46284
- "Instantiate": {
46285
- "name": "Instantiate",
46286
- "subtypes": [],
46287
- "props": {}
46288
- },
46289
- "IntegerOverflow": {
46290
- "name": "IntegerOverflow",
46291
- "subtypes": [],
46292
- "props": {}
46293
- },
46294
- "InternalMemoryDeclared": {
46295
- "name": "InternalMemoryDeclared",
46296
- "subtypes": [],
46297
- "props": {}
46298
- },
46299
- "InvalidAccountId": {
46300
- "name": "InvalidAccountId",
46609
+ "DeleteAccountStaking": {
46610
+ "name": "DeleteAccountStaking",
46301
46611
  "subtypes": [],
46302
46612
  "props": {
46303
46613
  "account_id": ""
46304
46614
  }
46305
46615
  },
46306
- "InvalidIteratorIndex": {
46307
- "name": "InvalidIteratorIndex",
46616
+ "DeleteAccountWithLargeState": {
46617
+ "name": "DeleteAccountWithLargeState",
46308
46618
  "subtypes": [],
46309
46619
  "props": {
46310
- "iterator_index": ""
46620
+ "account_id": ""
46311
46621
  }
46312
46622
  },
46313
- "InvalidMethodName": {
46314
- "name": "InvalidMethodName",
46623
+ "DeleteActionMustBeFinal": {
46624
+ "name": "DeleteActionMustBeFinal",
46315
46625
  "subtypes": [],
46316
46626
  "props": {}
46317
46627
  },
46318
- "InvalidPromiseIndex": {
46319
- "name": "InvalidPromiseIndex",
46320
- "subtypes": [],
46321
- "props": {
46322
- "promise_idx": ""
46323
- }
46324
- },
46325
- "InvalidPromiseResultIndex": {
46326
- "name": "InvalidPromiseResultIndex",
46628
+ "DeleteKeyDoesNotExist": {
46629
+ "name": "DeleteKeyDoesNotExist",
46327
46630
  "subtypes": [],
46328
46631
  "props": {
46329
- "result_idx": ""
46632
+ "account_id": "",
46633
+ "public_key": ""
46330
46634
  }
46331
46635
  },
46332
- "InvalidPublicKey": {
46333
- "name": "InvalidPublicKey",
46636
+ "DepositWithFunctionCall": {
46637
+ "name": "DepositWithFunctionCall",
46334
46638
  "subtypes": [],
46335
46639
  "props": {}
46336
46640
  },
46337
- "InvalidReceiptIndex": {
46338
- "name": "InvalidReceiptIndex",
46339
- "subtypes": [],
46340
- "props": {
46341
- "receipt_index": ""
46342
- }
46343
- },
46344
- "InvalidRegisterId": {
46345
- "name": "InvalidRegisterId",
46346
- "subtypes": [],
46347
- "props": {
46348
- "register_id": ""
46349
- }
46350
- },
46351
- "IteratorWasInvalidated": {
46352
- "name": "IteratorWasInvalidated",
46353
- "subtypes": [],
46354
- "props": {
46355
- "iterator_index": ""
46356
- }
46357
- },
46358
- "KeyLengthExceeded": {
46359
- "name": "KeyLengthExceeded",
46360
- "subtypes": [],
46361
- "props": {
46362
- "length": "",
46363
- "limit": ""
46364
- }
46365
- },
46366
- "LinkError": {
46367
- "name": "LinkError",
46641
+ "Deprecated": {
46642
+ "name": "Deprecated",
46368
46643
  "subtypes": [],
46369
46644
  "props": {
46370
- "msg": ""
46645
+ "method_name": ""
46371
46646
  }
46372
46647
  },
46373
- "Memory": {
46374
- "name": "Memory",
46375
- "subtypes": [],
46376
- "props": {}
46377
- },
46378
- "MemoryAccessViolation": {
46379
- "name": "MemoryAccessViolation",
46380
- "subtypes": [],
46381
- "props": {}
46382
- },
46383
- "MemoryOutOfBounds": {
46384
- "name": "MemoryOutOfBounds",
46385
- "subtypes": [],
46386
- "props": {}
46387
- },
46388
- "MethodEmptyName": {
46389
- "name": "MethodEmptyName",
46390
- "subtypes": [],
46391
- "props": {}
46392
- },
46393
- "MethodInvalidSignature": {
46394
- "name": "MethodInvalidSignature",
46395
- "subtypes": [],
46396
- "props": {}
46397
- },
46398
- "MethodNotFound": {
46399
- "name": "MethodNotFound",
46400
- "subtypes": [],
46401
- "props": {}
46402
- },
46403
- "MethodResolveError": {
46404
- "name": "MethodResolveError",
46405
- "subtypes": [
46406
- "MethodEmptyName",
46407
- "MethodUTF8Error",
46408
- "MethodNotFound",
46409
- "MethodInvalidSignature"
46410
- ],
46411
- "props": {}
46412
- },
46413
- "MethodUTF8Error": {
46414
- "name": "MethodUTF8Error",
46415
- "subtypes": [],
46416
- "props": {}
46417
- },
46418
- "MisalignedAtomicAccess": {
46419
- "name": "MisalignedAtomicAccess",
46648
+ "Deserialization": {
46649
+ "name": "Deserialization",
46420
46650
  "subtypes": [],
46421
46651
  "props": {}
46422
46652
  },
46423
- "NumberInputDataDependenciesExceeded": {
46424
- "name": "NumberInputDataDependenciesExceeded",
46653
+ "ECRecoverError": {
46654
+ "name": "ECRecoverError",
46425
46655
  "subtypes": [],
46426
46656
  "props": {
46427
- "limit": "",
46428
- "number_of_input_data_dependencies": ""
46657
+ "msg": ""
46429
46658
  }
46430
46659
  },
46431
- "NumberOfLogsExceeded": {
46432
- "name": "NumberOfLogsExceeded",
46660
+ "Ed25519VerifyInvalidInput": {
46661
+ "name": "Ed25519VerifyInvalidInput",
46433
46662
  "subtypes": [],
46434
46663
  "props": {
46435
- "limit": ""
46664
+ "msg": ""
46436
46665
  }
46437
46666
  },
46438
- "NumberPromisesExceeded": {
46439
- "name": "NumberPromisesExceeded",
46667
+ "EmptyMethodName": {
46668
+ "name": "EmptyMethodName",
46440
46669
  "subtypes": [],
46441
- "props": {
46442
- "limit": "",
46443
- "number_of_promises": ""
46444
- }
46445
- },
46446
- "PrepareError": {
46447
- "name": "PrepareError",
46448
- "subtypes": [
46449
- "Serialization",
46450
- "Deserialization",
46451
- "InternalMemoryDeclared",
46452
- "GasInstrumentation",
46453
- "StackHeightInstrumentation",
46454
- "Instantiate",
46455
- "Memory"
46456
- ],
46457
46670
  "props": {}
46458
46671
  },
46459
- "ProhibitedInView": {
46460
- "name": "ProhibitedInView",
46461
- "subtypes": [],
46462
- "props": {
46463
- "method_name": ""
46464
- }
46465
- },
46466
- "ReadError": {
46467
- "name": "ReadError",
46672
+ "Expired": {
46673
+ "name": "Expired",
46468
46674
  "subtypes": [],
46469
46675
  "props": {}
46470
46676
  },
46471
- "ReturnedValueLengthExceeded": {
46472
- "name": "ReturnedValueLengthExceeded",
46677
+ "FunctionCallArgumentsLengthExceeded": {
46678
+ "name": "FunctionCallArgumentsLengthExceeded",
46473
46679
  "subtypes": [],
46474
46680
  "props": {
46475
46681
  "length": "",
46476
46682
  "limit": ""
46477
46683
  }
46478
46684
  },
46479
- "Serialization": {
46480
- "name": "Serialization",
46481
- "subtypes": [],
46482
- "props": {}
46483
- },
46484
- "SerializationError": {
46485
- "name": "SerializationError",
46486
- "subtypes": [],
46487
- "props": {
46488
- "hash": ""
46489
- }
46490
- },
46491
- "StackHeightInstrumentation": {
46492
- "name": "StackHeightInstrumentation",
46493
- "subtypes": [],
46494
- "props": {}
46495
- },
46496
- "StackOverflow": {
46497
- "name": "StackOverflow",
46498
- "subtypes": [],
46499
- "props": {}
46500
- },
46501
- "TotalLogLengthExceeded": {
46502
- "name": "TotalLogLengthExceeded",
46685
+ "FunctionCallMethodNameLengthExceeded": {
46686
+ "name": "FunctionCallMethodNameLengthExceeded",
46503
46687
  "subtypes": [],
46504
46688
  "props": {
46505
46689
  "length": "",
46506
46690
  "limit": ""
46507
46691
  }
46508
46692
  },
46509
- "Unreachable": {
46510
- "name": "Unreachable",
46693
+ "FunctionCallZeroAttachedGas": {
46694
+ "name": "FunctionCallZeroAttachedGas",
46511
46695
  "subtypes": [],
46512
46696
  "props": {}
46513
46697
  },
46514
- "ValueLengthExceeded": {
46515
- "name": "ValueLengthExceeded",
46698
+ "GasExceeded": {
46699
+ "name": "GasExceeded",
46516
46700
  "subtypes": [],
46517
- "props": {
46518
- "length": "",
46519
- "limit": ""
46520
- }
46521
- },
46522
- "WasmTrap": {
46523
- "name": "WasmTrap",
46524
- "subtypes": [
46525
- "Unreachable",
46526
- "IncorrectCallIndirectSignature",
46527
- "MemoryOutOfBounds",
46528
- "CallIndirectOOB",
46529
- "IllegalArithmetic",
46530
- "MisalignedAtomicAccess",
46531
- "BreakpointTrap",
46532
- "StackOverflow",
46533
- "GenericTrap"
46534
- ],
46535
46701
  "props": {}
46536
46702
  },
46537
- "WasmUnknownError": {
46538
- "name": "WasmUnknownError",
46703
+ "GasInstrumentation": {
46704
+ "name": "GasInstrumentation",
46539
46705
  "subtypes": [],
46540
46706
  "props": {}
46541
46707
  },
46542
- "WasmerCompileError": {
46543
- "name": "WasmerCompileError",
46544
- "subtypes": [],
46545
- "props": {
46546
- "msg": ""
46547
- }
46548
- },
46549
- "WriteError": {
46550
- "name": "WriteError",
46708
+ "GasLimitExceeded": {
46709
+ "name": "GasLimitExceeded",
46551
46710
  "subtypes": [],
46552
46711
  "props": {}
46553
46712
  },
46554
- "AccessKeyNotFound": {
46555
- "name": "AccessKeyNotFound",
46556
- "subtypes": [],
46557
- "props": {
46558
- "account_id": "",
46559
- "public_key": ""
46560
- }
46561
- },
46562
- "AccountAlreadyExists": {
46563
- "name": "AccountAlreadyExists",
46713
+ "GenericTrap": {
46714
+ "name": "GenericTrap",
46564
46715
  "subtypes": [],
46565
- "props": {
46566
- "account_id": ""
46567
- }
46716
+ "props": {}
46568
46717
  },
46569
- "AccountDoesNotExist": {
46570
- "name": "AccountDoesNotExist",
46718
+ "GuestPanic": {
46719
+ "name": "GuestPanic",
46571
46720
  "subtypes": [],
46572
46721
  "props": {
46573
- "account_id": ""
46574
- }
46575
- },
46576
- "ActionError": {
46577
- "name": "ActionError",
46578
- "subtypes": [
46579
- "AccountAlreadyExists",
46580
- "AccountDoesNotExist",
46581
- "CreateAccountOnlyByRegistrar",
46582
- "CreateAccountNotAllowed",
46583
- "ActorNoPermission",
46584
- "DeleteKeyDoesNotExist",
46585
- "AddKeyAlreadyExists",
46586
- "DeleteAccountStaking",
46587
- "LackBalanceForState",
46588
- "TriesToUnstake",
46589
- "TriesToStake",
46590
- "InsufficientStake",
46591
- "FunctionCallError",
46592
- "NewReceiptValidationError",
46593
- "OnlyImplicitAccountCreationAllowed"
46594
- ],
46595
- "props": {
46596
- "index": ""
46722
+ "panic_msg": ""
46597
46723
  }
46598
46724
  },
46599
- "ActionsValidationError": {
46600
- "name": "ActionsValidationError",
46725
+ "HostError": {
46726
+ "name": "HostError",
46601
46727
  "subtypes": [
46602
- "DeleteActionMustBeFinal",
46603
- "TotalPrepaidGasExceeded",
46604
- "TotalNumberOfActionsExceeded",
46605
- "AddKeyMethodNamesNumberOfBytesExceeded",
46606
- "AddKeyMethodNameLengthExceeded",
46728
+ "BadUTF16",
46729
+ "BadUTF8",
46730
+ "GasExceeded",
46731
+ "GasLimitExceeded",
46732
+ "BalanceExceeded",
46733
+ "EmptyMethodName",
46734
+ "GuestPanic",
46607
46735
  "IntegerOverflow",
46736
+ "InvalidPromiseIndex",
46737
+ "CannotAppendActionToJointPromise",
46738
+ "CannotReturnJointPromise",
46739
+ "InvalidPromiseResultIndex",
46740
+ "InvalidRegisterId",
46741
+ "IteratorWasInvalidated",
46742
+ "MemoryAccessViolation",
46743
+ "InvalidReceiptIndex",
46744
+ "InvalidIteratorIndex",
46608
46745
  "InvalidAccountId",
46746
+ "InvalidMethodName",
46747
+ "InvalidPublicKey",
46748
+ "ProhibitedInView",
46749
+ "NumberOfLogsExceeded",
46750
+ "KeyLengthExceeded",
46751
+ "ValueLengthExceeded",
46752
+ "TotalLogLengthExceeded",
46753
+ "NumberPromisesExceeded",
46754
+ "NumberInputDataDependenciesExceeded",
46755
+ "ReturnedValueLengthExceeded",
46609
46756
  "ContractSizeExceeded",
46610
- "FunctionCallMethodNameLengthExceeded",
46611
- "FunctionCallArgumentsLengthExceeded",
46612
- "UnsuitableStakingKey",
46613
- "FunctionCallZeroAttachedGas"
46757
+ "Deprecated",
46758
+ "ECRecoverError",
46759
+ "AltBn128InvalidInput",
46760
+ "Ed25519VerifyInvalidInput"
46614
46761
  ],
46615
46762
  "props": {}
46616
46763
  },
46617
- "ActorNoPermission": {
46618
- "name": "ActorNoPermission",
46619
- "subtypes": [],
46620
- "props": {
46621
- "account_id": "",
46622
- "actor_id": ""
46623
- }
46624
- },
46625
- "AddKeyAlreadyExists": {
46626
- "name": "AddKeyAlreadyExists",
46627
- "subtypes": [],
46628
- "props": {
46629
- "account_id": "",
46630
- "public_key": ""
46631
- }
46632
- },
46633
- "AddKeyMethodNameLengthExceeded": {
46634
- "name": "AddKeyMethodNameLengthExceeded",
46635
- "subtypes": [],
46636
- "props": {
46637
- "length": "",
46638
- "limit": ""
46639
- }
46640
- },
46641
- "AddKeyMethodNamesNumberOfBytesExceeded": {
46642
- "name": "AddKeyMethodNamesNumberOfBytesExceeded",
46643
- "subtypes": [],
46644
- "props": {
46645
- "limit": "",
46646
- "total_number_of_bytes": ""
46647
- }
46648
- },
46649
- "BalanceMismatchError": {
46650
- "name": "BalanceMismatchError",
46651
- "subtypes": [],
46652
- "props": {
46653
- "final_accounts_balance": "",
46654
- "final_postponed_receipts_balance": "",
46655
- "incoming_receipts_balance": "",
46656
- "incoming_validator_rewards": "",
46657
- "initial_accounts_balance": "",
46658
- "initial_postponed_receipts_balance": "",
46659
- "new_delayed_receipts_balance": "",
46660
- "other_burnt_amount": "",
46661
- "outgoing_receipts_balance": "",
46662
- "processed_delayed_receipts_balance": "",
46663
- "slashed_burnt_amount": "",
46664
- "tx_burnt_amount": ""
46665
- }
46666
- },
46667
- "CostOverflow": {
46668
- "name": "CostOverflow",
46669
- "subtypes": [],
46670
- "props": {}
46671
- },
46672
- "CreateAccountNotAllowed": {
46673
- "name": "CreateAccountNotAllowed",
46674
- "subtypes": [],
46675
- "props": {
46676
- "account_id": "",
46677
- "predecessor_id": ""
46678
- }
46679
- },
46680
- "CreateAccountOnlyByRegistrar": {
46681
- "name": "CreateAccountOnlyByRegistrar",
46682
- "subtypes": [],
46683
- "props": {
46684
- "account_id": "",
46685
- "predecessor_id": "",
46686
- "registrar_account_id": ""
46687
- }
46688
- },
46689
- "DeleteAccountStaking": {
46690
- "name": "DeleteAccountStaking",
46691
- "subtypes": [],
46692
- "props": {
46693
- "account_id": ""
46694
- }
46695
- },
46696
- "DeleteActionMustBeFinal": {
46697
- "name": "DeleteActionMustBeFinal",
46764
+ "IllegalArithmetic": {
46765
+ "name": "IllegalArithmetic",
46698
46766
  "subtypes": [],
46699
46767
  "props": {}
46700
46768
  },
46701
- "DeleteKeyDoesNotExist": {
46702
- "name": "DeleteKeyDoesNotExist",
46703
- "subtypes": [],
46704
- "props": {
46705
- "account_id": "",
46706
- "public_key": ""
46707
- }
46708
- },
46709
- "DepositWithFunctionCall": {
46710
- "name": "DepositWithFunctionCall",
46769
+ "IncorrectCallIndirectSignature": {
46770
+ "name": "IncorrectCallIndirectSignature",
46711
46771
  "subtypes": [],
46712
46772
  "props": {}
46713
46773
  },
46714
- "Expired": {
46715
- "name": "Expired",
46774
+ "IndirectCallToNull": {
46775
+ "name": "IndirectCallToNull",
46716
46776
  "subtypes": [],
46717
46777
  "props": {}
46718
46778
  },
46719
- "FunctionCallArgumentsLengthExceeded": {
46720
- "name": "FunctionCallArgumentsLengthExceeded",
46721
- "subtypes": [],
46722
- "props": {
46723
- "length": "",
46724
- "limit": ""
46725
- }
46726
- },
46727
- "FunctionCallMethodNameLengthExceeded": {
46728
- "name": "FunctionCallMethodNameLengthExceeded",
46729
- "subtypes": [],
46730
- "props": {
46731
- "length": "",
46732
- "limit": ""
46733
- }
46734
- },
46735
- "FunctionCallZeroAttachedGas": {
46736
- "name": "FunctionCallZeroAttachedGas",
46779
+ "Instantiate": {
46780
+ "name": "Instantiate",
46737
46781
  "subtypes": [],
46738
46782
  "props": {}
46739
46783
  },
@@ -46746,6 +46790,16 @@ module.exports={
46746
46790
  "stake": ""
46747
46791
  }
46748
46792
  },
46793
+ "IntegerOverflow": {
46794
+ "name": "IntegerOverflow",
46795
+ "subtypes": [],
46796
+ "props": {}
46797
+ },
46798
+ "InternalMemoryDeclared": {
46799
+ "name": "InternalMemoryDeclared",
46800
+ "subtypes": [],
46801
+ "props": {}
46802
+ },
46749
46803
  "InvalidAccessKeyError": {
46750
46804
  "name": "InvalidAccessKeyError",
46751
46805
  "subtypes": [
@@ -46758,6 +46812,11 @@ module.exports={
46758
46812
  ],
46759
46813
  "props": {}
46760
46814
  },
46815
+ "InvalidAccountId": {
46816
+ "name": "InvalidAccountId",
46817
+ "subtypes": [],
46818
+ "props": {}
46819
+ },
46761
46820
  "InvalidChain": {
46762
46821
  "name": "InvalidChain",
46763
46822
  "subtypes": [],
@@ -46767,9 +46826,21 @@ module.exports={
46767
46826
  "name": "InvalidDataReceiverId",
46768
46827
  "subtypes": [],
46769
46828
  "props": {
46770
- "account_id": ""
46829
+ "account_id": ""
46830
+ }
46831
+ },
46832
+ "InvalidIteratorIndex": {
46833
+ "name": "InvalidIteratorIndex",
46834
+ "subtypes": [],
46835
+ "props": {
46836
+ "iterator_index": ""
46771
46837
  }
46772
46838
  },
46839
+ "InvalidMethodName": {
46840
+ "name": "InvalidMethodName",
46841
+ "subtypes": [],
46842
+ "props": {}
46843
+ },
46773
46844
  "InvalidNonce": {
46774
46845
  "name": "InvalidNonce",
46775
46846
  "subtypes": [],
@@ -46785,6 +46856,32 @@ module.exports={
46785
46856
  "account_id": ""
46786
46857
  }
46787
46858
  },
46859
+ "InvalidPromiseIndex": {
46860
+ "name": "InvalidPromiseIndex",
46861
+ "subtypes": [],
46862
+ "props": {
46863
+ "promise_idx": ""
46864
+ }
46865
+ },
46866
+ "InvalidPromiseResultIndex": {
46867
+ "name": "InvalidPromiseResultIndex",
46868
+ "subtypes": [],
46869
+ "props": {
46870
+ "result_idx": ""
46871
+ }
46872
+ },
46873
+ "InvalidPublicKey": {
46874
+ "name": "InvalidPublicKey",
46875
+ "subtypes": [],
46876
+ "props": {}
46877
+ },
46878
+ "InvalidReceiptIndex": {
46879
+ "name": "InvalidReceiptIndex",
46880
+ "subtypes": [],
46881
+ "props": {
46882
+ "receipt_index": ""
46883
+ }
46884
+ },
46788
46885
  "InvalidReceiverId": {
46789
46886
  "name": "InvalidReceiverId",
46790
46887
  "subtypes": [],
@@ -46792,6 +46889,13 @@ module.exports={
46792
46889
  "account_id": ""
46793
46890
  }
46794
46891
  },
46892
+ "InvalidRegisterId": {
46893
+ "name": "InvalidRegisterId",
46894
+ "subtypes": [],
46895
+ "props": {
46896
+ "register_id": ""
46897
+ }
46898
+ },
46795
46899
  "InvalidSignature": {
46796
46900
  "name": "InvalidSignature",
46797
46901
  "subtypes": [],
@@ -46811,6 +46915,7 @@ module.exports={
46811
46915
  "InvalidSignerId",
46812
46916
  "SignerDoesNotExist",
46813
46917
  "InvalidNonce",
46918
+ "NonceTooLarge",
46814
46919
  "InvalidReceiverId",
46815
46920
  "InvalidSignature",
46816
46921
  "NotEnoughBalance",
@@ -46818,10 +46923,26 @@ module.exports={
46818
46923
  "CostOverflow",
46819
46924
  "InvalidChain",
46820
46925
  "Expired",
46821
- "ActionsValidation"
46926
+ "ActionsValidation",
46927
+ "TransactionSizeExceeded"
46822
46928
  ],
46823
46929
  "props": {}
46824
46930
  },
46931
+ "IteratorWasInvalidated": {
46932
+ "name": "IteratorWasInvalidated",
46933
+ "subtypes": [],
46934
+ "props": {
46935
+ "iterator_index": ""
46936
+ }
46937
+ },
46938
+ "KeyLengthExceeded": {
46939
+ "name": "KeyLengthExceeded",
46940
+ "subtypes": [],
46941
+ "props": {
46942
+ "length": "",
46943
+ "limit": ""
46944
+ }
46945
+ },
46825
46946
  "LackBalanceForState": {
46826
46947
  "name": "LackBalanceForState",
46827
46948
  "subtypes": [],
@@ -46830,6 +46951,31 @@ module.exports={
46830
46951
  "amount": ""
46831
46952
  }
46832
46953
  },
46954
+ "Memory": {
46955
+ "name": "Memory",
46956
+ "subtypes": [],
46957
+ "props": {}
46958
+ },
46959
+ "MemoryAccessViolation": {
46960
+ "name": "MemoryAccessViolation",
46961
+ "subtypes": [],
46962
+ "props": {}
46963
+ },
46964
+ "MemoryOutOfBounds": {
46965
+ "name": "MemoryOutOfBounds",
46966
+ "subtypes": [],
46967
+ "props": {}
46968
+ },
46969
+ "MethodEmptyName": {
46970
+ "name": "MethodEmptyName",
46971
+ "subtypes": [],
46972
+ "props": {}
46973
+ },
46974
+ "MethodInvalidSignature": {
46975
+ "name": "MethodInvalidSignature",
46976
+ "subtypes": [],
46977
+ "props": {}
46978
+ },
46833
46979
  "MethodNameMismatch": {
46834
46980
  "name": "MethodNameMismatch",
46835
46981
  "subtypes": [],
@@ -46837,6 +46983,33 @@ module.exports={
46837
46983
  "method_name": ""
46838
46984
  }
46839
46985
  },
46986
+ "MethodNotFound": {
46987
+ "name": "MethodNotFound",
46988
+ "subtypes": [],
46989
+ "props": {}
46990
+ },
46991
+ "MethodResolveError": {
46992
+ "name": "MethodResolveError",
46993
+ "subtypes": [
46994
+ "MethodEmptyName",
46995
+ "MethodNotFound",
46996
+ "MethodInvalidSignature"
46997
+ ],
46998
+ "props": {}
46999
+ },
47000
+ "MisalignedAtomicAccess": {
47001
+ "name": "MisalignedAtomicAccess",
47002
+ "subtypes": [],
47003
+ "props": {}
47004
+ },
47005
+ "NonceTooLarge": {
47006
+ "name": "NonceTooLarge",
47007
+ "subtypes": [],
47008
+ "props": {
47009
+ "tx_nonce": "",
47010
+ "upper_bound": ""
47011
+ }
47012
+ },
46840
47013
  "NotEnoughAllowance": {
46841
47014
  "name": "NotEnoughAllowance",
46842
47015
  "subtypes": [],
@@ -46856,6 +47029,29 @@ module.exports={
46856
47029
  "signer_id": ""
46857
47030
  }
46858
47031
  },
47032
+ "NumberInputDataDependenciesExceeded": {
47033
+ "name": "NumberInputDataDependenciesExceeded",
47034
+ "subtypes": [],
47035
+ "props": {
47036
+ "limit": "",
47037
+ "number_of_input_data_dependencies": ""
47038
+ }
47039
+ },
47040
+ "NumberOfLogsExceeded": {
47041
+ "name": "NumberOfLogsExceeded",
47042
+ "subtypes": [],
47043
+ "props": {
47044
+ "limit": ""
47045
+ }
47046
+ },
47047
+ "NumberPromisesExceeded": {
47048
+ "name": "NumberPromisesExceeded",
47049
+ "subtypes": [],
47050
+ "props": {
47051
+ "limit": "",
47052
+ "number_of_promises": ""
47053
+ }
47054
+ },
46859
47055
  "OnlyImplicitAccountCreationAllowed": {
46860
47056
  "name": "OnlyImplicitAccountCreationAllowed",
46861
47057
  "subtypes": [],
@@ -46863,6 +47059,28 @@ module.exports={
46863
47059
  "account_id": ""
46864
47060
  }
46865
47061
  },
47062
+ "PrepareError": {
47063
+ "name": "PrepareError",
47064
+ "subtypes": [
47065
+ "Serialization",
47066
+ "Deserialization",
47067
+ "InternalMemoryDeclared",
47068
+ "GasInstrumentation",
47069
+ "StackHeightInstrumentation",
47070
+ "Instantiate",
47071
+ "Memory",
47072
+ "TooManyFunctions",
47073
+ "TooManyLocals"
47074
+ ],
47075
+ "props": {}
47076
+ },
47077
+ "ProhibitedInView": {
47078
+ "name": "ProhibitedInView",
47079
+ "subtypes": [],
47080
+ "props": {
47081
+ "method_name": ""
47082
+ }
47083
+ },
46866
47084
  "ReceiptValidationError": {
46867
47085
  "name": "ReceiptValidationError",
46868
47086
  "subtypes": [
@@ -46889,6 +47107,19 @@ module.exports={
46889
47107
  "subtypes": [],
46890
47108
  "props": {}
46891
47109
  },
47110
+ "ReturnedValueLengthExceeded": {
47111
+ "name": "ReturnedValueLengthExceeded",
47112
+ "subtypes": [],
47113
+ "props": {
47114
+ "length": "",
47115
+ "limit": ""
47116
+ }
47117
+ },
47118
+ "Serialization": {
47119
+ "name": "Serialization",
47120
+ "subtypes": [],
47121
+ "props": {}
47122
+ },
46892
47123
  "SignerDoesNotExist": {
46893
47124
  "name": "SignerDoesNotExist",
46894
47125
  "subtypes": [],
@@ -46896,6 +47127,34 @@ module.exports={
46896
47127
  "signer_id": ""
46897
47128
  }
46898
47129
  },
47130
+ "StackHeightInstrumentation": {
47131
+ "name": "StackHeightInstrumentation",
47132
+ "subtypes": [],
47133
+ "props": {}
47134
+ },
47135
+ "StackOverflow": {
47136
+ "name": "StackOverflow",
47137
+ "subtypes": [],
47138
+ "props": {}
47139
+ },
47140
+ "TooManyFunctions": {
47141
+ "name": "TooManyFunctions",
47142
+ "subtypes": [],
47143
+ "props": {}
47144
+ },
47145
+ "TooManyLocals": {
47146
+ "name": "TooManyLocals",
47147
+ "subtypes": [],
47148
+ "props": {}
47149
+ },
47150
+ "TotalLogLengthExceeded": {
47151
+ "name": "TotalLogLengthExceeded",
47152
+ "subtypes": [],
47153
+ "props": {
47154
+ "length": "",
47155
+ "limit": ""
47156
+ }
47157
+ },
46899
47158
  "TotalNumberOfActionsExceeded": {
46900
47159
  "name": "TotalNumberOfActionsExceeded",
46901
47160
  "subtypes": [],
@@ -46912,6 +47171,14 @@ module.exports={
46912
47171
  "total_prepaid_gas": ""
46913
47172
  }
46914
47173
  },
47174
+ "TransactionSizeExceeded": {
47175
+ "name": "TransactionSizeExceeded",
47176
+ "subtypes": [],
47177
+ "props": {
47178
+ "limit": "",
47179
+ "size": ""
47180
+ }
47181
+ },
46915
47182
  "TriesToStake": {
46916
47183
  "name": "TriesToStake",
46917
47184
  "subtypes": [],
@@ -46937,6 +47204,11 @@ module.exports={
46937
47204
  ],
46938
47205
  "props": {}
46939
47206
  },
47207
+ "Unreachable": {
47208
+ "name": "Unreachable",
47209
+ "subtypes": [],
47210
+ "props": {}
47211
+ },
46940
47212
  "UnsuitableStakingKey": {
46941
47213
  "name": "UnsuitableStakingKey",
46942
47214
  "subtypes": [],
@@ -46944,13 +47216,46 @@ module.exports={
46944
47216
  "public_key": ""
46945
47217
  }
46946
47218
  },
46947
- "Closed": {
46948
- "name": "Closed",
47219
+ "UnsupportedProtocolFeature": {
47220
+ "name": "UnsupportedProtocolFeature",
47221
+ "subtypes": [],
47222
+ "props": {
47223
+ "protocol_feature": "",
47224
+ "version": ""
47225
+ }
47226
+ },
47227
+ "ValueLengthExceeded": {
47228
+ "name": "ValueLengthExceeded",
46949
47229
  "subtypes": [],
47230
+ "props": {
47231
+ "length": "",
47232
+ "limit": ""
47233
+ }
47234
+ },
47235
+ "WasmTrap": {
47236
+ "name": "WasmTrap",
47237
+ "subtypes": [
47238
+ "Unreachable",
47239
+ "IncorrectCallIndirectSignature",
47240
+ "MemoryOutOfBounds",
47241
+ "CallIndirectOOB",
47242
+ "IllegalArithmetic",
47243
+ "MisalignedAtomicAccess",
47244
+ "IndirectCallToNull",
47245
+ "StackOverflow",
47246
+ "GenericTrap"
47247
+ ],
46950
47248
  "props": {}
46951
47249
  },
46952
- "InternalError": {
46953
- "name": "InternalError",
47250
+ "WasmerCompileError": {
47251
+ "name": "WasmerCompileError",
47252
+ "subtypes": [],
47253
+ "props": {
47254
+ "msg": ""
47255
+ }
47256
+ },
47257
+ "Closed": {
47258
+ "name": "Closed",
46954
47259
  "subtypes": [],
46955
47260
  "props": {}
46956
47261
  },
@@ -46959,8 +47264,7 @@ module.exports={
46959
47264
  "subtypes": [
46960
47265
  "TxExecutionError",
46961
47266
  "Timeout",
46962
- "Closed",
46963
- "InternalError"
47267
+ "Closed"
46964
47268
  ],
46965
47269
  "props": {}
46966
47270
  },
@@ -47071,6 +47375,12 @@ function getErrorTypeFromErrorMessage(errorMessage, errorType) {
47071
47375
  return 'AccessKeyDoesNotExist';
47072
47376
  case /wasm execution failed with error: FunctionCallError\(CompilationError\(CodeDoesNotExist/.test(errorMessage):
47073
47377
  return 'CodeDoesNotExist';
47378
+ case /wasm execution failed with error: CompilationError\(CodeDoesNotExist/.test(errorMessage):
47379
+ return 'CodeDoesNotExist';
47380
+ case /wasm execution failed with error: FunctionCallError\(MethodResolveError\(MethodNotFound/.test(errorMessage):
47381
+ return 'MethodNotFound';
47382
+ case /wasm execution failed with error: MethodResolveError\(MethodNotFound/.test(errorMessage):
47383
+ return 'MethodNotFound';
47074
47384
  case /Transaction nonce \d+ must be larger than nonce of the used access key \d+/.test(errorMessage):
47075
47385
  return 'InvalidNonce';
47076
47386
  default:
@@ -47110,7 +47420,7 @@ exports.NEAR_NOMINATION_EXP = 24;
47110
47420
  * Number of indivisible units in one NEAR. Derived from {@link NEAR_NOMINATION_EXP}.
47111
47421
  */
47112
47422
  exports.NEAR_NOMINATION = new bn_js_1.default('10', 10).pow(new bn_js_1.default(exports.NEAR_NOMINATION_EXP, 10));
47113
- // Pre-calculate offests used for rounding to different number of digits
47423
+ // Pre-calculate offsets used for rounding to different number of digits
47114
47424
  const ROUNDING_OFFSETS = [];
47115
47425
  const BN10 = new bn_js_1.default(10);
47116
47426
  for (let i = 0, offset = new bn_js_1.default(5); i < exports.NEAR_NOMINATION_EXP; i++, offset = offset.mul(BN10)) {
@@ -47472,10 +47782,10 @@ const bn_js_1 = __importDefault(require("bn.js"));
47472
47782
  const depd_1 = __importDefault(require("depd"));
47473
47783
  /** Finds seat price given validators stakes and number of seats.
47474
47784
  * Calculation follow the spec: https://nomicon.io/Economics/README.html#validator-selection
47475
- * @params validators: current or next epoch validators.
47476
- * @params maxNumberOfSeats: maximum number of seats in the network.
47477
- * @params minimumStakeRatio: minimum stake ratio
47478
- * @params protocolVersion: version of the protocol from genesis config
47785
+ * @param validators: current or next epoch validators.
47786
+ * @param maxNumberOfSeats: maximum number of seats in the network.
47787
+ * @param minimumStakeRatio: minimum stake ratio
47788
+ * @param protocolVersion: version of the protocol from genesis config
47479
47789
  */
47480
47790
  function findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio, protocolVersion) {
47481
47791
  if (protocolVersion && protocolVersion < 49) {
@@ -47484,7 +47794,7 @@ function findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio, protocol
47484
47794
  if (!minimumStakeRatio) {
47485
47795
  const deprecate = (0, depd_1.default)('findSeatPrice(validators, maxNumberOfSeats)');
47486
47796
  deprecate('`use `findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio)` instead');
47487
- minimumStakeRatio = [1, 6250]; // harcoded minimumStakeRation from 12/7/21
47797
+ minimumStakeRatio = [1, 6250]; // hardcoded minimumStakeRation from 12/7/21
47488
47798
  }
47489
47799
  return findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumStakeRatio);
47490
47800
  }
@@ -47532,8 +47842,8 @@ function findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumSt
47532
47842
  }
47533
47843
  /** Diff validators between current and next epoch.
47534
47844
  * Returns additions, subtractions and changes to validator set.
47535
- * @params currentValidators: list of current validators.
47536
- * @params nextValidators: list of next validators.
47845
+ * @param currentValidators: list of current validators.
47846
+ * @param nextValidators: list of next validators.
47537
47847
  */
47538
47848
  function diffEpochValidators(currentValidators, nextValidators) {
47539
47849
  const validatorsMap = new Map();
@@ -47771,7 +48081,7 @@ class WalletConnection {
47771
48081
  return this._authData.accountId || '';
47772
48082
  }
47773
48083
  /**
47774
- * Redirects current page to the wallet authentication page.
48084
+ * Constructs string URL to the wallet authentication page.
47775
48085
  * @param options An optional options object
47776
48086
  * @param options.contractId The NEAR account where the contract is deployed
47777
48087
  * @param options.successUrl URL to redirect upon success. Default: current url
@@ -47780,11 +48090,11 @@ class WalletConnection {
47780
48090
  * @example
47781
48091
  * ```js
47782
48092
  * const wallet = new WalletConnection(near, 'my-app');
47783
- * // redirects to the NEAR Wallet
47784
- * wallet.requestSignIn({ contractId: 'account-with-deploy-contract.near' });
48093
+ * // return string URL to the NEAR Wallet
48094
+ * const url = await wallet.requestSignInUrl({ contractId: 'account-with-deploy-contract.near' });
47785
48095
  * ```
47786
48096
  */
47787
- requestSignIn({ contractId, methodNames, successUrl, failureUrl }) {
48097
+ requestSignInUrl({ contractId, methodNames, successUrl, failureUrl }) {
47788
48098
  return __awaiter(this, void 0, void 0, function* () {
47789
48099
  const currentUrl = new URL(window.location.href);
47790
48100
  const newUrl = new URL(this._walletBaseUrl + LOGIN_WALLET_URL_SUFFIX);
@@ -47804,26 +48114,63 @@ class WalletConnection {
47804
48114
  newUrl.searchParams.append('methodNames', methodName);
47805
48115
  });
47806
48116
  }
47807
- window.location.assign(newUrl.toString());
48117
+ return newUrl.toString();
47808
48118
  });
47809
48119
  }
47810
48120
  /**
47811
- * Requests the user to quickly sign for a transaction or batch of transactions by redirecting to the NEAR wallet.
48121
+ * Redirects current page to the wallet authentication page.
48122
+ * @param options An optional options object
48123
+ * @param options.contractId The NEAR account where the contract is deployed
48124
+ * @param options.successUrl URL to redirect upon success. Default: current url
48125
+ * @param options.failureUrl URL to redirect upon failure. Default: current url
48126
+ *
48127
+ * @example
48128
+ * ```js
48129
+ * const wallet = new WalletConnection(near, 'my-app');
48130
+ * // redirects to the NEAR Wallet
48131
+ * wallet.requestSignIn({ contractId: 'account-with-deploy-contract.near' });
48132
+ * ```
47812
48133
  */
47813
- requestSignTransactions({ transactions, meta, callbackUrl }) {
48134
+ requestSignIn(options) {
47814
48135
  return __awaiter(this, void 0, void 0, function* () {
47815
- const currentUrl = new URL(window.location.href);
47816
- const newUrl = new URL('sign', this._walletBaseUrl);
47817
- newUrl.searchParams.set('transactions', transactions
47818
- .map(transaction => (0, borsh_1.serialize)(transactions_1.SCHEMA.Transaction, transaction))
47819
- .map(serialized => Buffer.from(serialized).toString('base64'))
47820
- .join(','));
47821
- newUrl.searchParams.set('callbackUrl', callbackUrl || currentUrl.href);
47822
- if (meta)
47823
- newUrl.searchParams.set('meta', meta);
47824
- window.location.assign(newUrl.toString());
48136
+ const url = yield this.requestSignInUrl(options);
48137
+ window.location.assign(url);
47825
48138
  });
47826
48139
  }
48140
+ /**
48141
+ * Constructs string URL to the wallet to sign a transaction or batch of transactions.
48142
+ *
48143
+ * @param options A required options object
48144
+ * @param options.transactions List of transactions to sign
48145
+ * @param options.callbackUrl URL to redirect upon success. Default: current url
48146
+ * @param options.meta Meta information the wallet will send back to the application. `meta` will be attached to the `callbackUrl` as a url search param
48147
+ *
48148
+ */
48149
+ requestSignTransactionsUrl({ transactions, meta, callbackUrl }) {
48150
+ const currentUrl = new URL(window.location.href);
48151
+ const newUrl = new URL('sign', this._walletBaseUrl);
48152
+ newUrl.searchParams.set('transactions', transactions
48153
+ .map(transaction => (0, borsh_1.serialize)(transactions_1.SCHEMA.Transaction, transaction))
48154
+ .map(serialized => Buffer.from(serialized).toString('base64'))
48155
+ .join(','));
48156
+ newUrl.searchParams.set('callbackUrl', callbackUrl || currentUrl.href);
48157
+ if (meta)
48158
+ newUrl.searchParams.set('meta', meta);
48159
+ return newUrl.toString();
48160
+ }
48161
+ /**
48162
+ * Requests the user to quickly sign for a transaction or batch of transactions by redirecting to the wallet.
48163
+ *
48164
+ * @param options A required options object
48165
+ * @param options.transactions List of transactions to sign
48166
+ * @param options.callbackUrl URL to redirect upon success. Default: current url
48167
+ * @param options.meta Meta information the wallet will send back to the application. `meta` will be attached to the `callbackUrl` as a url search param
48168
+ *
48169
+ */
48170
+ requestSignTransactions(options) {
48171
+ const url = this.requestSignTransactionsUrl(options);
48172
+ window.location.assign(url);
48173
+ }
47827
48174
  /**
47828
48175
  * @hidden
47829
48176
  * Complete sign in for a given account id and public key. To be invoked by the app when getting a callback from the wallet.
@@ -47898,6 +48245,11 @@ class ConnectedWalletAccount extends accounts_1.Account {
47898
48245
  /**
47899
48246
  * Sign a transaction by redirecting to the NEAR Wallet
47900
48247
  * @see {@link WalletConnection#requestSignTransactions}
48248
+ * @param options An optional options object
48249
+ * @param options.receiverId The NEAR account ID of the transaction receiver.
48250
+ * @param options.actions An array of transaction actions to be performed.
48251
+ * @param options.walletMeta Additional metadata to be included in the wallet signing request.
48252
+ * @param options.walletCallbackUrl URL to redirect upon completion of the wallet signing process. Default: current URL.
47901
48253
  */
47902
48254
  signAndSendTransaction({ receiverId, actions, walletMeta, walletCallbackUrl = window.location.href }) {
47903
48255
  const _super = Object.create(null, {