@verified-network/verified-sdk 2.4.9 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/contract/amm/margin/index.d.ts +1 -1
  2. package/dist/contract/amm/margin/index.js +2 -2
  3. package/dist/contract/amm/primary/index.d.ts +1 -1
  4. package/dist/contract/amm/primary/index.js +2 -2
  5. package/dist/contract/amm/secondary/index.d.ts +1 -1
  6. package/dist/contract/amm/secondary/index.js +2 -2
  7. package/dist/contract/bond/index.d.ts +1 -1
  8. package/dist/contract/bond/index.js +2 -2
  9. package/dist/contract/cash/index.d.ts +1 -1
  10. package/dist/contract/cash/index.js +2 -2
  11. package/dist/contract/client/index.d.ts +1 -1
  12. package/dist/contract/client/index.js +2 -2
  13. package/dist/contract/custody/index.d.ts +1 -1
  14. package/dist/contract/custody/index.js +2 -2
  15. package/dist/contract/distribution/index.d.ts +1 -1
  16. package/dist/contract/distribution/index.js +2 -2
  17. package/dist/contract/erc20/index.d.ts +1 -1
  18. package/dist/contract/erc20/index.js +2 -2
  19. package/dist/contract/factory/index.d.ts +1 -1
  20. package/dist/contract/factory/index.js +2 -2
  21. package/dist/contract/index.d.ts +2 -1
  22. package/dist/contract/index.js +85 -37
  23. package/dist/contract/liquidity/index.d.ts +1 -1
  24. package/dist/contract/liquidity/index.js +2 -2
  25. package/dist/contract/loans/compound/index.d.ts +1 -1
  26. package/dist/contract/loans/compound/index.js +2 -2
  27. package/dist/contract/pool/index.d.ts +1 -1
  28. package/dist/contract/pool/index.js +2 -2
  29. package/dist/contract/rates/index.d.ts +1 -1
  30. package/dist/contract/rates/index.js +2 -2
  31. package/dist/contract/securitiesfactory/index.d.ts +1 -1
  32. package/dist/contract/securitiesfactory/index.js +2 -2
  33. package/dist/contract/security/index.d.ts +1 -1
  34. package/dist/contract/security/index.js +2 -2
  35. package/dist/contract/token/index.d.ts +1 -1
  36. package/dist/contract/token/index.js +2 -2
  37. package/dist/contractAddress/index.js +302 -302
  38. package/dist/lib/abi/boostrap.d.ts +878 -0
  39. package/dist/lib/abi/boostrap.js +1151 -0
  40. package/dist/lib/abi/boostrap.json +1150 -0
  41. package/dist/lib/abi/composability.d.ts +66 -0
  42. package/dist/lib/abi/composability.js +273 -0
  43. package/dist/lib/abi/entrypoint.d.ts +775 -0
  44. package/dist/lib/abi/entrypoint.js +660 -0
  45. package/dist/lib/abi/factory.json +325 -0
  46. package/dist/lib/biconomyRNFix.d.ts +20737 -0
  47. package/dist/lib/biconomyRNFix.js +974 -0
  48. package/dist/utils/constants.js +3 -0
  49. package/package.json +2 -2
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
3
3
  export default class MarginIssueManager extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -24,8 +24,8 @@ class MarginIssueManager extends index_1.VerifiedContract {
24
24
  super(address, JSON.stringify(MarginIssueManager_json_1.abi), signer);
25
25
  this.contractAddress = address;
26
26
  }
27
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
28
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
27
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
28
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
29
29
  }
30
30
  async issueProduct(security, securityType, currency, cficode, securityAmount, minOrderSize, currencyAmount, margin, collateral, tradeFee, options) {
31
31
  await this.validateInput(index_1.DATATYPES.ADDRESS, security);
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
3
3
  export default class PrimaryIssueManager extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, platformAddress: string, platform: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -29,8 +29,8 @@ class PrimaryIssueManager extends index_1.VerifiedContract {
29
29
  super(address, JSON.stringify(abiKyber), signer);
30
30
  this.contractAddress = address;
31
31
  }
32
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
33
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
32
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
33
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
34
34
  }
35
35
  async offer(owned, isin, offered, tomatch, desired, min, issuer, docs, options) {
36
36
  await this.validateInput(index_1.DATATYPES.ADDRESS, owned);
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
3
3
  export default class SecondaryIssueManager extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -22,8 +22,8 @@ class SecondaryIssueManager extends index_1.VerifiedContract {
22
22
  super(address, JSON.stringify(SecondaryIssueManager_json_1.abi), signer);
23
23
  this.contractAddress = address;
24
24
  }
25
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
26
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
25
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
26
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
27
27
  }
28
28
  async issueSecondary(security, currency, securityOutstanding, securityAmount, minOrderSize, currencyAmount, options) {
29
29
  await this.validateInput(index_1.DATATYPES.ADDRESS, security);
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
3
3
  export default class Bond extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, bondCurrencyAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -35,8 +35,8 @@ class Bond extends index_1.VerifiedContract {
35
35
  super(address, JSON.stringify(Bond_json_1.abi), signer);
36
36
  this.contractAddress = address;
37
37
  }
38
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
39
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
38
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
39
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
40
40
  }
41
41
  async requestIssue(_amount, _payer, _payee, _currency, _cashContract, options) {
42
42
  await this.validateInput(index_1.DATATYPES.NUMBER, _amount);
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
3
3
  export default class Cash extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, currencyAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -32,8 +32,8 @@ class Cash extends index_1.VerifiedContract {
32
32
  super(address, JSON.stringify(Cash_json_1.abi), signer);
33
33
  this.contractAddress = address;
34
34
  }
35
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
36
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
35
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
36
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
37
37
  }
38
38
  /**
39
39
  * Request pay out [callable by manager]
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
3
3
  export default class Client extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -32,8 +32,8 @@ class Client extends index_1.VerifiedContract {
32
32
  super(address, JSON.stringify(Client_json_1.abi), signer);
33
33
  this.contractAddress = address;
34
34
  }
35
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
36
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
35
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
36
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
37
37
  }
38
38
  async setSigner(_address, options) {
39
39
  await this.validateInput(index_1.DATATYPES.ADDRESS, _address);
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
3
3
  export default class Custody extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -35,8 +35,8 @@ class Custody extends index_1.VerifiedContract {
35
35
  super(address, JSON.stringify(Vault_json_1.abi), signer);
36
36
  this.contractAddress = address;
37
37
  }
38
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
39
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
38
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
39
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
40
40
  }
41
41
  async createVault(_creator, options) {
42
42
  await this.validateInput(index_1.DATATYPES.BYTE32, _creator);
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
3
3
  export default class Distribution extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -22,8 +22,8 @@ class Distribution extends index_1.VerifiedContract {
22
22
  super(address, JSON.stringify(Distribution_json_1.abi), signer);
23
23
  this.contractAddress = address;
24
24
  }
25
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
26
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
25
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
26
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
27
27
  }
28
28
  /**
29
29
  Shares fee income with revenue shareholders
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
3
3
  export default class ERC20 extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -24,8 +24,8 @@ class ERC20 extends index_1.VerifiedContract {
24
24
  super(address, JSON.stringify(ERC20_json_1.abi), signer);
25
25
  this.contractAddress = address;
26
26
  }
27
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
28
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
27
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
28
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
29
29
  }
30
30
  async name() {
31
31
  return this.callContract(FUNCTIONS.NAME);
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
3
3
  export default class Factory extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -30,8 +30,8 @@ class Factory extends index_1.VerifiedContract {
30
30
  super(address, JSON.stringify(Factory_json_1.abi), signer);
31
31
  this.contractAddress = address;
32
32
  }
33
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
34
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
33
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
34
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
35
35
  }
36
36
  /**
37
37
  * Get number of tokens [callable by client]
@@ -26,6 +26,7 @@ export type Options = {
26
26
  paymentToken?: string;
27
27
  apiKey?: string;
28
28
  rpcUrl?: string;
29
+ isReactNative?: boolean;
29
30
  };
30
31
  export declare class VerifiedContract {
31
32
  private signer;
@@ -61,7 +62,7 @@ export declare class VerifiedContract {
61
62
  /** Constructs and call function using MEE client that allows gas payment in ERC20 tokens */
62
63
  callFunctionWithMEEClient(nexusAccount: any, chainId: number, tx: any, paymentToken: `0x${string}`, _apiKey?: string): Promise<SCResponse>;
63
64
  callContract(functionName: string, ...args: any): Promise<SCResponse>;
64
- getQuote(paymentTokenAddress: string, functionName: string, args: any[], rpc?: string, _apiKey?: string): Promise<{
65
+ getQuote(paymentTokenAddress: string, functionName: string, args: any[], rpc?: string, _apiKey?: string, isReactNative?: boolean): Promise<{
65
66
  tokenAddress: string;
66
67
  amount: string;
67
68
  amountInWei: string;
@@ -8,6 +8,7 @@ const constants_1 = require("../utils/constants");
8
8
  const abstractjs_1 = require("@biconomy/abstractjs");
9
9
  const chains_1 = require("viem/chains");
10
10
  const viem_1 = require("viem");
11
+ const biconomyRNFix_1 = require("../lib/biconomyRNFix");
11
12
  var STATUS;
12
13
  (function (STATUS) {
13
14
  STATUS[STATUS["SUCCESS"] = 0] = "SUCCESS";
@@ -405,15 +406,21 @@ class VerifiedContract {
405
406
  }
406
407
  /** Constructs and call function using MEE client that allows gas payment in ERC20 tokens */
407
408
  async callFunctionWithMEEClient(nexusAccount, chainId, tx, paymentToken, _apiKey) {
408
- var _a, _b, _c;
409
+ var _a, _b, _c, _d;
409
410
  let res = {};
410
411
  let txHash = "";
411
412
  let recp;
412
413
  try {
413
- const meeClient = await (0, abstractjs_1.createMeeClient)({
414
- account: nexusAccount,
415
- apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
416
- });
414
+ const meeClient = ((_a = constants_1.PaymasterConstants.TEST_CHAINS) === null || _a === void 0 ? void 0 : _a.includes(chainId))
415
+ ? await (0, abstractjs_1.createMeeClient)({
416
+ account: nexusAccount,
417
+ url: constants_1.PaymasterConstants.MEE_URL_STAGING,
418
+ apiKey: constants_1.PaymasterConstants.MEE_API_KEY_STAGING,
419
+ })
420
+ : await (0, abstractjs_1.createMeeClient)({
421
+ account: nexusAccount,
422
+ apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
423
+ });
417
424
  const transactionInstruction = await nexusAccount.build({
418
425
  type: "default",
419
426
  data: {
@@ -435,9 +442,11 @@ class VerifiedContract {
435
442
  console.log(`MEE transaction hash: ${hash}`);
436
443
  // Wait for transaction to complete
437
444
  const receipt = await meeClient.waitForSupertransactionReceipt({ hash });
438
- if (((_a = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _a === void 0 ? void 0 : _a.length) > 1) {
439
- //at least 2 receipts
440
- const txReceipt = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[((_b = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _b === void 0 ? void 0 : _b.length) - 1];
445
+ // console.log("receipts: ", receipt);
446
+ // console.log("receipt: ", receipt?.receipts);
447
+ if (((_b = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _b === void 0 ? void 0 : _b.length) > 0) {
448
+ //always pick last receipt????
449
+ const txReceipt = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[((_c = receipt === null || receipt === void 0 ? void 0 : receipt.receipts) === null || _c === void 0 ? void 0 : _c.length) - 1];
441
450
  if ((txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.status) === "success") {
442
451
  res.status = STATUS.SUCCESS;
443
452
  res.response = {
@@ -457,10 +466,10 @@ class VerifiedContract {
457
466
  return res;
458
467
  }
459
468
  else {
460
- console.error("MEE client transaction failed with error: ", "Receipts lesser than one.");
469
+ console.error("MEE client transaction failed with error: ", "Invalid receipts length");
461
470
  res.status = STATUS.ERROR;
462
471
  res.response = {
463
- hash: (_c = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0]) === null || _c === void 0 ? void 0 : _c.transactionHash,
472
+ hash: (_d = receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0]) === null || _d === void 0 ? void 0 : _d.transactionHash,
464
473
  result: receipt === null || receipt === void 0 ? void 0 : receipt.receipts[0],
465
474
  }; //TODO: update result on response
466
475
  res.message = "";
@@ -479,7 +488,7 @@ class VerifiedContract {
479
488
  }
480
489
  }
481
490
  async callContract(functionName, ...args) {
482
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
491
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
483
492
  // Check if the function is a read function
484
493
  if (this.isReadFunction(functionName)) {
485
494
  console.log("read function will use ethers");
@@ -533,22 +542,36 @@ class VerifiedContract {
533
542
  }
534
543
  const prov = this.signer.provider;
535
544
  const rpcUrl = (_e = prov === null || prov === void 0 ? void 0 : prov.connection) === null || _e === void 0 ? void 0 : _e.url;
536
- const nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
537
- chains: [chainToUse],
538
- transports: [
539
- (0, viem_1.http)(rpcUrl ||
540
- ((_f = optionsRaw[0]) === null || _f === void 0 ? void 0 : _f.rpcUrl) ||
541
- ((_g = constants_1.PaymasterConstants[Number(chainId)]) === null || _g === void 0 ? void 0 : _g.RPC_URL)),
542
- ],
543
- signer: _signer,
544
- });
545
+ let nexusAccount;
546
+ if ((_f = optionsRaw[0]) === null || _f === void 0 ? void 0 : _f.isReactNative) {
547
+ nexusAccount = await (0, biconomyRNFix_1.createMultiChainNexusAccount)({
548
+ chains: [chainToUse],
549
+ transports: [
550
+ (0, viem_1.http)(rpcUrl ||
551
+ ((_g = optionsRaw[0]) === null || _g === void 0 ? void 0 : _g.rpcUrl) ||
552
+ ((_h = constants_1.PaymasterConstants[Number(chainId)]) === null || _h === void 0 ? void 0 : _h.RPC_URL)),
553
+ ],
554
+ signer: _signer,
555
+ });
556
+ }
557
+ else {
558
+ nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
559
+ chains: [chainToUse],
560
+ transports: [
561
+ (0, viem_1.http)(rpcUrl ||
562
+ ((_j = optionsRaw[0]) === null || _j === void 0 ? void 0 : _j.rpcUrl) ||
563
+ ((_k = constants_1.PaymasterConstants[Number(chainId)]) === null || _k === void 0 ? void 0 : _k.RPC_URL)),
564
+ ],
565
+ signer: _signer,
566
+ });
567
+ }
545
568
  const meeAddress = nexusAccount.addressOn(chainId);
546
569
  // console.log("nexus account address: ", meeAddress);
547
- return await this.callFunctionWithMEEClient(nexusAccount, chainId, tx1, (_h = optionsRaw[0]) === null || _h === void 0 ? void 0 : _h.paymentToken, (_j = optionsRaw[0]) === null || _j === void 0 ? void 0 : _j.apiKey);
570
+ return await this.callFunctionWithMEEClient(nexusAccount, chainId, tx1, (_l = optionsRaw[0]) === null || _l === void 0 ? void 0 : _l.paymentToken, (_m = optionsRaw[0]) === null || _m === void 0 ? void 0 : _m.apiKey);
548
571
  }
549
572
  else {
550
573
  console.log("Using Userop since no payment token...");
551
- const paymentToken = ((_k = options[0]) === null || _k === void 0 ? void 0 : _k.paymentToken) ||
574
+ const paymentToken = ((_o = options[0]) === null || _o === void 0 ? void 0 : _o.paymentToken) ||
552
575
  constants_1.PaymasterConstants[`${chainId}`]["PAYMENT_TOKEN"] ||
553
576
  "";
554
577
  return await this.callFunctionAsUserOp(smartAccount, tx1, functionName, paymentToken, ...args);
@@ -560,8 +583,8 @@ class VerifiedContract {
560
583
  return await this.callFunctionWithEthers(functionName, ...args);
561
584
  }
562
585
  }
563
- async getQuote(paymentTokenAddress, functionName, args, rpc, _apiKey) {
564
- var _a, _b, _c, _d;
586
+ async getQuote(paymentTokenAddress, functionName, args, rpc, _apiKey, isReactNative) {
587
+ var _a, _b, _c, _d, _e, _f;
565
588
  const chainId = await this.signer.getChainId();
566
589
  if (this.supportsGasless(chainId)) {
567
590
  const _signer = this.signer;
@@ -576,13 +599,32 @@ class VerifiedContract {
576
599
  if (chainToUse) {
577
600
  const prov = this.signer.provider;
578
601
  const rpcUrl = (_a = prov.connection) === null || _a === void 0 ? void 0 : _a.url;
579
- const nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
580
- chains: [chainToUse],
581
- transports: [
582
- (0, viem_1.http)(rpcUrl || rpc || ((_b = constants_1.PaymasterConstants[Number(chainId)]) === null || _b === void 0 ? void 0 : _b.RPC_URL)),
583
- ],
584
- signer: _signer,
585
- });
602
+ let nexusAccount;
603
+ if (isReactNative) {
604
+ nexusAccount = await (0, biconomyRNFix_1.createMultiChainNexusAccount)({
605
+ chains: [chainToUse],
606
+ transports: [
607
+ (0, viem_1.http)(rpcUrl || rpc || ((_b = constants_1.PaymasterConstants[Number(chainId)]) === null || _b === void 0 ? void 0 : _b.RPC_URL)),
608
+ ],
609
+ signer: _signer,
610
+ });
611
+ }
612
+ else {
613
+ nexusAccount = await (0, abstractjs_1.toMultichainNexusAccount)({
614
+ chains: [chainToUse],
615
+ transports: [
616
+ (0, viem_1.http)(rpcUrl || rpc || ((_c = constants_1.PaymasterConstants[Number(chainId)]) === null || _c === void 0 ? void 0 : _c.RPC_URL)),
617
+ ],
618
+ signer: _signer,
619
+ });
620
+ }
621
+ // const nexusAccount = await toMultichainNexusAccount({
622
+ // chains: [chainToUse],
623
+ // transports: [
624
+ // http(rpcUrl || rpc || PaymasterConstants[Number(chainId)]?.RPC_URL),
625
+ // ],
626
+ // signer: _signer,
627
+ // });
586
628
  if (paymentTokenAddress) {
587
629
  //construct calldata for function
588
630
  try {
@@ -592,10 +634,16 @@ class VerifiedContract {
592
634
  to: this.contract.address,
593
635
  data: _res.data,
594
636
  };
595
- const meeClient = await (0, abstractjs_1.createMeeClient)({
596
- account: nexusAccount,
597
- apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
598
- });
637
+ const meeClient = ((_d = constants_1.PaymasterConstants.TEST_CHAINS) === null || _d === void 0 ? void 0 : _d.includes(chainId))
638
+ ? await (0, abstractjs_1.createMeeClient)({
639
+ account: nexusAccount,
640
+ url: constants_1.PaymasterConstants.MEE_URL_STAGING,
641
+ apiKey: constants_1.PaymasterConstants.MEE_API_KEY_STAGING,
642
+ })
643
+ : await (0, abstractjs_1.createMeeClient)({
644
+ account: nexusAccount,
645
+ apiKey: _apiKey || constants_1.PaymasterConstants.MEE_API_KEY,
646
+ });
599
647
  const transactionInstruction = await nexusAccount.build({
600
648
  type: "default",
601
649
  data: {
@@ -619,10 +667,10 @@ class VerifiedContract {
619
667
  };
620
668
  }
621
669
  catch (err) {
622
- if ((_c = err === null || err === void 0 ? void 0 : err.message) === null || _c === void 0 ? void 0 : _c.includes("fn is not a function")) {
670
+ if ((_e = err === null || err === void 0 ? void 0 : err.message) === null || _e === void 0 ? void 0 : _e.includes("fn is not a function")) {
623
671
  console.error(`Function ${functionName} not found in contract's ABI`);
624
672
  }
625
- else if ((_d = err === null || err === void 0 ? void 0 : err.message) === null || _d === void 0 ? void 0 : _d.includes("code=INVALID_ARGUMENT")) {
673
+ else if ((_f = err === null || err === void 0 ? void 0 : err.message) === null || _f === void 0 ? void 0 : _f.includes("code=INVALID_ARGUMENT")) {
626
674
  console.error(`Invalid arguments type`);
627
675
  }
628
676
  console.error((err === null || err === void 0 ? void 0 : err.message) || "getQuote failed.");
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
3
3
  export default class LiquidityContract extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -37,8 +37,8 @@ class LiquidityContract extends index_1.VerifiedContract {
37
37
  super(address, JSON.stringify(Liquidity_json_1.abi), signer);
38
38
  this.contractAddress = address;
39
39
  }
40
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
41
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
40
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
41
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
42
42
  }
43
43
  /**
44
44
  Creates supply of the Verified Liquidity token after initial issue with constructor defined parameters
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
3
3
  export default class Compound extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -19,8 +19,8 @@ class Compound extends index_1.VerifiedContract {
19
19
  super(address, JSON.stringify(VerifiedMarkets_json_1.abi), signer);
20
20
  this.contractAddress = address;
21
21
  }
22
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
23
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
22
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
23
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
24
24
  }
25
25
  async setSigner(_address, options) {
26
26
  await this.validateInput(index_1.DATATYPES.ADDRESS, _address);
@@ -24,7 +24,7 @@ type Funds = {
24
24
  export default class PoolContract extends VerifiedContract {
25
25
  contractAddress: string;
26
26
  constructor(signer: VerifiedWallet);
27
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
27
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
28
28
  tokenAddress: string;
29
29
  amount: string;
30
30
  amountInWei: string;
@@ -21,8 +21,8 @@ class PoolContract extends index_1.VerifiedContract {
21
21
  super(address, JSON.stringify(Vault_json_1.abi), signer);
22
22
  this.contractAddress = address;
23
23
  }
24
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
25
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
24
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
25
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
26
26
  }
27
27
  async swap(_swap, _funds, _limit, _deadline, options) {
28
28
  const { poolId, kind, assetIn, assetOut, amount, userData } = _swap;
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
3
3
  export default class Rates extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -19,8 +19,8 @@ class Rates extends index_1.VerifiedContract {
19
19
  super(address, JSON.stringify(Rates_json_1.abi), signer);
20
20
  this.contractAddress = address;
21
21
  }
22
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
23
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
22
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
23
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
24
24
  }
25
25
  async setFeeTo(_feeTo, _fee, _feeType, options) {
26
26
  await this.validateInput(index_1.DATATYPES.ADDRESS, _feeTo);
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
3
3
  export default class SecuritiesFactory extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, contractNetworkAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -28,8 +28,8 @@ class SecuritiesFactory extends index_1.VerifiedContract {
28
28
  super(address, JSON.stringify(SecuritiesFactory_json_1.abi), signer);
29
29
  this.contractAddress = address;
30
30
  }
31
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
32
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
31
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
32
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
33
33
  }
34
34
  /**
35
35
  Sets signer to verify bridge
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../../wallet";
3
3
  export default class Security extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, tokenAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -40,8 +40,8 @@ class Security extends index_1.VerifiedContract {
40
40
  super(address, JSON.stringify(Security_json_1.abi), signer);
41
41
  this.contractAddress = address;
42
42
  }
43
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
44
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
43
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
44
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
45
45
  }
46
46
  async whiteList(_spender, _amount, options) {
47
47
  await this.validateInput(index_1.DATATYPES.ADDRESS, _spender);
@@ -3,7 +3,7 @@ import { VerifiedWallet } from "../../wallet";
3
3
  export default class Token extends VerifiedContract {
4
4
  contractAddress: string;
5
5
  constructor(signer: VerifiedWallet, bondCurrencyAddress: string);
6
- _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string): Promise<{
6
+ _getMeeQuote(paymentTokenAddress: string, functionName: string, args: any[], apiKey?: string, rpcUrl?: string, isReactNative?: boolean): Promise<{
7
7
  tokenAddress: string;
8
8
  amount: string;
9
9
  amountInWei: string;
@@ -28,8 +28,8 @@ class Token extends index_1.VerifiedContract {
28
28
  super(address, JSON.stringify(Token_json_1.abi), signer);
29
29
  this.contractAddress = address;
30
30
  }
31
- async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl) {
32
- return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey);
31
+ async _getMeeQuote(paymentTokenAddress, functionName, args, apiKey, rpcUrl, isReactNative) {
32
+ return await this.getQuote(paymentTokenAddress, functionName, args, rpcUrl, apiKey, isReactNative);
33
33
  }
34
34
  /**
35
35
  * Lend by purchasing bond token against other cash token [callable by client]