@vetro-protocol/gateway 1.3.0 → 1.3.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 (102) hide show
  1. package/_esm/actions/index.js +49 -21
  2. package/_esm/actions/index.js.map +7 -1
  3. package/_esm/chunk-ZE4YZMXK.js +1326 -0
  4. package/_esm/chunk-ZE4YZMXK.js.map +7 -0
  5. package/_esm/index.js +57 -31
  6. package/_esm/index.js.map +7 -1
  7. package/_types/actions/index.d.ts +18 -18
  8. package/_types/actions/public/getGateway.d.ts.map +1 -1
  9. package/_types/actions/public/getMaxMint.d.ts.map +1 -1
  10. package/_types/actions/public/getMaxWithdraw.d.ts.map +1 -1
  11. package/_types/actions/public/getMintFee.d.ts.map +1 -1
  12. package/_types/actions/public/getPeggedToken.d.ts.map +1 -1
  13. package/_types/actions/public/getRedeemFee.d.ts.map +1 -1
  14. package/_types/actions/public/getRedeemRequest.d.ts.map +1 -1
  15. package/_types/actions/public/getTreasury.d.ts.map +1 -1
  16. package/_types/actions/public/getWithdrawalDelay.d.ts.map +1 -1
  17. package/_types/actions/public/getWithdrawalDelayEnabled.d.ts.map +1 -1
  18. package/_types/actions/public/index.d.ts +14 -14
  19. package/_types/actions/public/isInstantRedeemWhitelisted.d.ts.map +1 -1
  20. package/_types/actions/public/previewDeposit.d.ts.map +1 -1
  21. package/_types/actions/public/previewRedeem.d.ts.map +1 -1
  22. package/_types/actions/public/previewWithdraw.d.ts.map +1 -1
  23. package/_types/actions/wallet/cancelRedeemRequest.d.ts +1 -1
  24. package/_types/actions/wallet/deposit.d.ts +1 -1
  25. package/_types/actions/wallet/redeem.d.ts +1 -1
  26. package/_types/actions/wallet/requestRedeem.d.ts +1 -1
  27. package/_types/gatewayAddresses.d.ts.map +1 -1
  28. package/_types/index.d.ts +12 -12
  29. package/package.json +7 -5
  30. package/src/actions/index.ts +18 -18
  31. package/src/actions/public/getGateway.ts +2 -2
  32. package/src/actions/public/getMaxMint.ts +2 -2
  33. package/src/actions/public/getMaxWithdraw.ts +2 -2
  34. package/src/actions/public/getMintFee.ts +2 -2
  35. package/src/actions/public/getPeggedToken.ts +2 -2
  36. package/src/actions/public/getRedeemFee.ts +2 -2
  37. package/src/actions/public/getRedeemRequest.ts +2 -2
  38. package/src/actions/public/getTreasury.ts +2 -2
  39. package/src/actions/public/getWithdrawalDelay.ts +2 -2
  40. package/src/actions/public/getWithdrawalDelayEnabled.ts +2 -2
  41. package/src/actions/public/index.ts +14 -14
  42. package/src/actions/public/isInstantRedeemWhitelisted.ts +2 -2
  43. package/src/actions/public/previewDeposit.ts +2 -2
  44. package/src/actions/public/previewRedeem.ts +2 -2
  45. package/src/actions/public/previewWithdraw.ts +2 -2
  46. package/src/actions/wallet/cancelRedeemRequest.ts +2 -2
  47. package/src/actions/wallet/deposit.ts +2 -2
  48. package/src/actions/wallet/redeem.ts +6 -6
  49. package/src/actions/wallet/requestRedeem.ts +3 -3
  50. package/src/gatewayAddresses.ts +6 -17
  51. package/src/index.ts +8 -8
  52. package/_esm/abi/gatewayAbi.js +0 -223
  53. package/_esm/abi/gatewayAbi.js.map +0 -1
  54. package/_esm/abi/peggedTokenAbi.js +0 -10
  55. package/_esm/abi/peggedTokenAbi.js.map +0 -1
  56. package/_esm/actions/public/getGateway.js +0 -30
  57. package/_esm/actions/public/getGateway.js.map +0 -1
  58. package/_esm/actions/public/getMaxMint.js +0 -23
  59. package/_esm/actions/public/getMaxMint.js.map +0 -1
  60. package/_esm/actions/public/getMaxWithdraw.js +0 -28
  61. package/_esm/actions/public/getMaxWithdraw.js.map +0 -1
  62. package/_esm/actions/public/getMintFee.js +0 -28
  63. package/_esm/actions/public/getMintFee.js.map +0 -1
  64. package/_esm/actions/public/getPeggedToken.js +0 -23
  65. package/_esm/actions/public/getPeggedToken.js.map +0 -1
  66. package/_esm/actions/public/getRedeemFee.js +0 -28
  67. package/_esm/actions/public/getRedeemFee.js.map +0 -1
  68. package/_esm/actions/public/getRedeemRequest.js +0 -28
  69. package/_esm/actions/public/getRedeemRequest.js.map +0 -1
  70. package/_esm/actions/public/getTreasury.js +0 -23
  71. package/_esm/actions/public/getTreasury.js.map +0 -1
  72. package/_esm/actions/public/getWithdrawalDelay.js +0 -23
  73. package/_esm/actions/public/getWithdrawalDelay.js.map +0 -1
  74. package/_esm/actions/public/getWithdrawalDelayEnabled.js +0 -23
  75. package/_esm/actions/public/getWithdrawalDelayEnabled.js.map +0 -1
  76. package/_esm/actions/public/index.js +0 -15
  77. package/_esm/actions/public/index.js.map +0 -1
  78. package/_esm/actions/public/isInstantRedeemWhitelisted.js +0 -28
  79. package/_esm/actions/public/isInstantRedeemWhitelisted.js.map +0 -1
  80. package/_esm/actions/public/previewDeposit.js +0 -35
  81. package/_esm/actions/public/previewDeposit.js.map +0 -1
  82. package/_esm/actions/public/previewRedeem.js +0 -35
  83. package/_esm/actions/public/previewRedeem.js.map +0 -1
  84. package/_esm/actions/public/previewWithdraw.js +0 -35
  85. package/_esm/actions/public/previewWithdraw.js.map +0 -1
  86. package/_esm/actions/wallet/cancelRedeemRequest.js +0 -89
  87. package/_esm/actions/wallet/cancelRedeemRequest.js.map +0 -1
  88. package/_esm/actions/wallet/deposit.js +0 -193
  89. package/_esm/actions/wallet/deposit.js.map +0 -1
  90. package/_esm/actions/wallet/redeem.js +0 -226
  91. package/_esm/actions/wallet/redeem.js.map +0 -1
  92. package/_esm/actions/wallet/requestRedeem.js +0 -153
  93. package/_esm/actions/wallet/requestRedeem.js.map +0 -1
  94. package/_esm/gatewayAddresses.js +0 -18
  95. package/_esm/gatewayAddresses.js.map +0 -1
  96. package/_esm/types.js +0 -2
  97. package/_esm/types.js.map +0 -1
  98. package/_esm/utils/isAddressValid.js +0 -3
  99. package/_esm/utils/isAddressValid.js.map +0 -1
  100. package/_types/utils/isAddressValid.d.ts +0 -3
  101. package/_types/utils/isAddressValid.d.ts.map +0 -1
  102. package/src/utils/isAddressValid.ts +0 -4
@@ -1,30 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { peggedTokenAbi } from "../../abi/peggedTokenAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- /**
5
- * Reads the gateway address for a given pegged token.
6
- * @param client - The viem client used to read the contract.
7
- * @param parameters - The parameters object.
8
- * @param parameters.address - The pegged token address to read the gateway from.
9
- * @returns The gateway address configured on the pegged token.
10
- */
11
- export async function getGateway(client, parameters) {
12
- // Validate client
13
- if (!client) {
14
- throw new Error("Client is not defined");
15
- }
16
- // Validate parameters exist
17
- if (!parameters) {
18
- throw new Error("Parameters are required");
19
- }
20
- // Validate pegged token address
21
- if (!isAddressValid(parameters.address)) {
22
- throw new Error("Pegged token is invalid");
23
- }
24
- return readContract(client, {
25
- abi: peggedTokenAbi,
26
- address: parameters.address,
27
- functionName: "gateway",
28
- });
29
- }
30
- //# sourceMappingURL=getGateway.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGateway.js","sourceRoot":"","sources":["../../../src/actions/public/getGateway.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,gCAAgC;IAChC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,cAAc;QACnB,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,SAAS;KACxB,CAAC,CAAC;AACL,CAAC"}
@@ -1,23 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function getMaxMint(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- return readContract(client, {
18
- abi: gatewayAbi,
19
- address: parameters.address,
20
- functionName: "maxMint",
21
- });
22
- }
23
- //# sourceMappingURL=getMaxMint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getMaxMint.js","sourceRoot":"","sources":["../../../src/actions/public/getMaxMint.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,SAAS;KACxB,CAAC,CAAC;AACL,CAAC"}
@@ -1,28 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function getMaxWithdraw(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- // Validate tokenOut address
18
- if (!isAddressValid(parameters.tokenOut)) {
19
- throw new Error("Token is invalid");
20
- }
21
- return readContract(client, {
22
- abi: gatewayAbi,
23
- address: parameters.address,
24
- args: [parameters.tokenOut],
25
- functionName: "maxWithdraw",
26
- });
27
- }
28
- //# sourceMappingURL=getMaxWithdraw.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getMaxWithdraw.js","sourceRoot":"","sources":["../../../src/actions/public/getMaxWithdraw.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC3B,YAAY,EAAE,aAAa;KAC5B,CAAC,CAAC;AACL,CAAC"}
@@ -1,28 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function getMintFee(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- // Validate token address
18
- if (!isAddressValid(parameters.token)) {
19
- throw new Error("Token is invalid");
20
- }
21
- return readContract(client, {
22
- abi: gatewayAbi,
23
- address: parameters.address,
24
- args: [parameters.token],
25
- functionName: "mintFee",
26
- });
27
- }
28
- //# sourceMappingURL=getMintFee.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getMintFee.js","sourceRoot":"","sources":["../../../src/actions/public/getMintFee.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,yBAAyB;IACzB,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;QACxB,YAAY,EAAE,SAAS;KACxB,CAAC,CAAC;AACL,CAAC"}
@@ -1,23 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function getPeggedToken(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- return readContract(client, {
18
- abi: gatewayAbi,
19
- address: parameters.address,
20
- functionName: "PEGGED_TOKEN",
21
- });
22
- }
23
- //# sourceMappingURL=getPeggedToken.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPeggedToken.js","sourceRoot":"","sources":["../../../src/actions/public/getPeggedToken.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,cAAc;KAC7B,CAAC,CAAC;AACL,CAAC"}
@@ -1,28 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function getRedeemFee(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- // Validate token address
18
- if (!isAddressValid(parameters.token)) {
19
- throw new Error("Token is invalid");
20
- }
21
- return readContract(client, {
22
- abi: gatewayAbi,
23
- address: parameters.address,
24
- args: [parameters.token],
25
- functionName: "redeemFee",
26
- });
27
- }
28
- //# sourceMappingURL=getRedeemFee.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRedeemFee.js","sourceRoot":"","sources":["../../../src/actions/public/getRedeemFee.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,yBAAyB;IACzB,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC;QACxB,YAAY,EAAE,WAAW;KAC1B,CAAC,CAAC;AACL,CAAC"}
@@ -1,28 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function getRedeemRequest(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- // Validate user address
18
- if (!isAddressValid(parameters.user)) {
19
- throw new Error("User is invalid");
20
- }
21
- return readContract(client, {
22
- abi: gatewayAbi,
23
- address: parameters.address,
24
- args: [parameters.user],
25
- functionName: "getRedeemRequest",
26
- });
27
- }
28
- //# sourceMappingURL=getRedeemRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRedeemRequest.js","sourceRoot":"","sources":["../../../src/actions/public/getRedeemRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,wBAAwB;IACxB,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;QACvB,YAAY,EAAE,kBAAkB;KACjC,CAAC,CAAC;AACL,CAAC"}
@@ -1,23 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function getTreasury(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- return readContract(client, {
18
- abi: gatewayAbi,
19
- address: parameters.address,
20
- functionName: "treasury",
21
- });
22
- }
23
- //# sourceMappingURL=getTreasury.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getTreasury.js","sourceRoot":"","sources":["../../../src/actions/public/getTreasury.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,UAAU;KACzB,CAAC,CAAC;AACL,CAAC"}
@@ -1,23 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function getWithdrawalDelay(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- return readContract(client, {
18
- abi: gatewayAbi,
19
- address: parameters.address,
20
- functionName: "withdrawalDelay",
21
- });
22
- }
23
- //# sourceMappingURL=getWithdrawalDelay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getWithdrawalDelay.js","sourceRoot":"","sources":["../../../src/actions/public/getWithdrawalDelay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,iBAAiB;KAChC,CAAC,CAAC;AACL,CAAC"}
@@ -1,23 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function getWithdrawalDelayEnabled(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- return readContract(client, {
18
- abi: gatewayAbi,
19
- address: parameters.address,
20
- functionName: "withdrawalDelayEnabled",
21
- });
22
- }
23
- //# sourceMappingURL=getWithdrawalDelayEnabled.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getWithdrawalDelayEnabled.js","sourceRoot":"","sources":["../../../src/actions/public/getWithdrawalDelayEnabled.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,MAAc,EACd,UAEC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,YAAY,EAAE,wBAAwB;KACvC,CAAC,CAAC;AACL,CAAC"}
@@ -1,15 +0,0 @@
1
- export * from "./getGateway.js";
2
- export * from "./getMaxMint.js";
3
- export * from "./getMaxWithdraw.js";
4
- export * from "./getMintFee.js";
5
- export * from "./getPeggedToken.js";
6
- export * from "./getRedeemFee.js";
7
- export * from "./getRedeemRequest.js";
8
- export * from "./getTreasury.js";
9
- export * from "./getWithdrawalDelay.js";
10
- export * from "./getWithdrawalDelayEnabled.js";
11
- export * from "./isInstantRedeemWhitelisted.js";
12
- export * from "./previewDeposit.js";
13
- export * from "./previewRedeem.js";
14
- export * from "./previewWithdraw.js";
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/public/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
@@ -1,28 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function isInstantRedeemWhitelisted(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- // Validate account address
18
- if (!isAddressValid(parameters.account)) {
19
- throw new Error("Account is invalid");
20
- }
21
- return readContract(client, {
22
- abi: gatewayAbi,
23
- address: parameters.address,
24
- args: [parameters.account],
25
- functionName: "isInstantRedeemWhitelisted",
26
- });
27
- }
28
- //# sourceMappingURL=isInstantRedeemWhitelisted.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isInstantRedeemWhitelisted.js","sourceRoot":"","sources":["../../../src/actions/public/isInstantRedeemWhitelisted.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,MAAc,EACd,UAGC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QAC1B,YAAY,EAAE,4BAA4B;KAC3C,CAAC,CAAC;AACL,CAAC"}
@@ -1,35 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function previewDeposit(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- // Validate tokenIn address
18
- if (!isAddressValid(parameters.tokenIn)) {
19
- throw new Error("Token is invalid");
20
- }
21
- // Validate amountIn
22
- if (typeof parameters.amountIn !== "bigint") {
23
- throw new Error("Amount must be a bigint");
24
- }
25
- if (parameters.amountIn <= 0n) {
26
- throw new Error("Amount must be greater than 0");
27
- }
28
- return readContract(client, {
29
- abi: gatewayAbi,
30
- address: parameters.address,
31
- args: [parameters.tokenIn, parameters.amountIn],
32
- functionName: "previewDeposit",
33
- });
34
- }
35
- //# sourceMappingURL=previewDeposit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"previewDeposit.js","sourceRoot":"","sources":["../../../src/actions/public/previewDeposit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,UAIC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,oBAAoB;IACpB,IAAI,OAAO,UAAU,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,UAAU,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC;QAC/C,YAAY,EAAE,gBAAgB;KAC/B,CAAC,CAAC;AACL,CAAC"}
@@ -1,35 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function previewRedeem(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- // Validate tokenOut address
18
- if (!isAddressValid(parameters.tokenOut)) {
19
- throw new Error("Token is invalid");
20
- }
21
- // Validate peggedTokenIn
22
- if (typeof parameters.peggedTokenIn !== "bigint") {
23
- throw new Error("Amount must be a bigint");
24
- }
25
- if (parameters.peggedTokenIn <= 0n) {
26
- throw new Error("Amount must be greater than 0");
27
- }
28
- return readContract(client, {
29
- abi: gatewayAbi,
30
- address: parameters.address,
31
- args: [parameters.tokenOut, parameters.peggedTokenIn],
32
- functionName: "previewRedeem",
33
- });
34
- }
35
- //# sourceMappingURL=previewRedeem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"previewRedeem.js","sourceRoot":"","sources":["../../../src/actions/public/previewRedeem.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAc,EACd,UAIC;IAED,kBAAkB;IAClB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACxC,CAAC;IAED,4BAA4B;IAC5B,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,yBAAyB;IACzB,IAAI,OAAO,UAAU,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,UAAU,CAAC,aAAa,IAAI,EAAE,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,EAAE;QAC1B,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC;QACrD,YAAY,EAAE,eAAe;KAC9B,CAAC,CAAC;AACL,CAAC"}
@@ -1,35 +0,0 @@
1
- import { readContract } from "viem/actions";
2
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
3
- import { isAddressValid } from "../../utils/isAddressValid.js";
4
- export async function previewWithdraw(client, parameters) {
5
- // Validate client
6
- if (!client) {
7
- throw new Error("Client is not defined");
8
- }
9
- // Validate parameters exist
10
- if (!parameters) {
11
- throw new Error("Parameters are required");
12
- }
13
- // Validate gateway address
14
- if (!isAddressValid(parameters.address)) {
15
- throw new Error("Gateway is invalid");
16
- }
17
- // Validate tokenOut address
18
- if (!isAddressValid(parameters.tokenOut)) {
19
- throw new Error("Token is invalid");
20
- }
21
- // Validate amountOut
22
- if (typeof parameters.amountOut !== "bigint") {
23
- throw new Error("Amount must be a bigint");
24
- }
25
- if (parameters.amountOut <= 0n) {
26
- throw new Error("Amount must be greater than 0");
27
- }
28
- return readContract(client, {
29
- abi: gatewayAbi,
30
- address: parameters.address,
31
- args: [parameters.tokenOut, parameters.amountOut],
32
- functionName: "previewWithdraw",
33
- });
34
- }
35
- //# sourceMappingURL=previewWithdraw.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"previewWithdraw.js","sourceRoot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AAC,CAAC;AACL,CAAC"}
@@ -1,89 +0,0 @@
1
- import { toPromiseEvent } from "to-promise-event";
2
- import { encodeFunctionData, isAddress, isAddressEqual, zeroAddress, } from "viem";
3
- import { waitForTransactionReceipt, writeContract } from "viem/actions";
4
- import { gatewayAbi } from "../../abi/gatewayAbi.js";
5
- const canCancelRedeemRequest = function ({ client, gatewayAddress, }) {
6
- if (!client) {
7
- return {
8
- canCancelRedeemRequest: false,
9
- reason: "Client is not defined",
10
- };
11
- }
12
- if (!client.chain) {
13
- return {
14
- canCancelRedeemRequest: false,
15
- reason: "Chain is not defined on wallet client",
16
- };
17
- }
18
- if (!client.account) {
19
- return {
20
- canCancelRedeemRequest: false,
21
- reason: "Client must have an account",
22
- };
23
- }
24
- // Validate gateway address
25
- if (!gatewayAddress || !isAddress(gatewayAddress)) {
26
- return {
27
- canCancelRedeemRequest: false,
28
- reason: "Invalid gateway address",
29
- };
30
- }
31
- if (isAddressEqual(gatewayAddress, zeroAddress)) {
32
- return {
33
- canCancelRedeemRequest: false,
34
- reason: "Gateway address cannot be zero address",
35
- };
36
- }
37
- return { canCancelRedeemRequest: true };
38
- };
39
- const runCancelRedeemRequest = (walletClient, { gatewayAddress }) => async function (emitter) {
40
- try {
41
- const { canCancelRedeemRequest: canCancelRedeemRequestFlag, reason } = canCancelRedeemRequest({
42
- client: walletClient,
43
- gatewayAddress,
44
- });
45
- if (!canCancelRedeemRequestFlag) {
46
- emitter.emit("cancel-redeem-request-failed-validation", reason);
47
- return;
48
- }
49
- emitter.emit("pre-cancel-redeem-request");
50
- const cancelHash = await writeContract(walletClient, {
51
- abi: gatewayAbi,
52
- account: walletClient.account,
53
- address: gatewayAddress,
54
- chain: walletClient.chain,
55
- functionName: "cancelRedeemRequest",
56
- }).catch(function (error) {
57
- emitter.emit("user-signing-cancel-redeem-request-error", error);
58
- });
59
- if (!cancelHash) {
60
- return;
61
- }
62
- emitter.emit("user-signed-cancel-redeem-request", cancelHash);
63
- const cancelReceipt = await waitForTransactionReceipt(walletClient, {
64
- hash: cancelHash,
65
- }).catch(function (error) {
66
- emitter.emit("cancel-redeem-request-failed", error);
67
- });
68
- if (!cancelReceipt) {
69
- return;
70
- }
71
- const cancelEventMap = {
72
- reverted: "cancel-redeem-request-transaction-reverted",
73
- success: "cancel-redeem-request-transaction-succeeded",
74
- };
75
- emitter.emit(cancelEventMap[cancelReceipt.status], cancelReceipt);
76
- }
77
- catch (error) {
78
- emitter.emit("unexpected-error", error);
79
- }
80
- finally {
81
- emitter.emit("cancel-redeem-request-settled");
82
- }
83
- };
84
- export const cancelRedeemRequest = (...args) => toPromiseEvent(runCancelRedeemRequest(...args));
85
- export const encodeCancelRedeemRequest = () => encodeFunctionData({
86
- abi: gatewayAbi,
87
- functionName: "cancelRedeemRequest",
88
- });
89
- //# sourceMappingURL=cancelRedeemRequest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cancelRedeemRequest.js","sourceRoot":"","sources":["../../../src/actions/wallet/cancelRedeemRequest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAIL,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAOrD,MAAM,sBAAsB,GAAG,UAAU,EACvC,MAAM,EACN,cAAc,GAIf;IAIC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,sBAAsB,EAAE,KAAK;YAC7B,MAAM,EAAE,uBAAuB;SAChC,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO;YACL,sBAAsB,EAAE,KAAK;YAC7B,MAAM,EAAE,uCAAuC;SAChD,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAA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