@directcryptopay/sdk 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -87
- package/dist/core/config.d.ts +9 -46
- package/dist/core/iframe.d.ts +16 -0
- package/dist/dcp-sdk.umd.js +1 -12811
- package/dist/dcp.d.ts +12 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +219 -2
- package/dist/types.d.ts +26 -164
- package/package.json +3 -13
- package/dist/ExchangeController-CbO41bcH.js +0 -217
- package/dist/HelpersUtil-DHm6EVSE.js +0 -120
- package/dist/NavigationUtil-kj9LEOOd.js +0 -8
- package/dist/PhArrowCircleDown-lsK25DCk.js +0 -73
- package/dist/PhArrowClockwise-NeKHZ1co.js +0 -73
- package/dist/PhArrowDown-C9AkNvLs.js +0 -73
- package/dist/PhArrowLeft-RNfIQP1X.js +0 -73
- package/dist/PhArrowRight-DM1tna0G.js +0 -73
- package/dist/PhArrowSquareOut-S5XYbAZj.js +0 -73
- package/dist/PhArrowUp-DmktzOWy.js +0 -73
- package/dist/PhArrowUpRight-BkNeW_5i.js +0 -73
- package/dist/PhArrowsClockwise-CQ4pG76b.js +0 -73
- package/dist/PhArrowsDownUp-H6gxaNM6.js +0 -73
- package/dist/PhArrowsLeftRight-DZSsfMR6.js +0 -73
- package/dist/PhBank-4_9QzqIB.js +0 -73
- package/dist/PhBrowser-B-JSznId.js +0 -73
- package/dist/PhCaretDown-vV5oHMNi.js +0 -73
- package/dist/PhCaretLeft-BLo6Y_f4.js +0 -73
- package/dist/PhCaretRight-CqQN4TT3.js +0 -73
- package/dist/PhCaretUp-Df7UCAHy.js +0 -73
- package/dist/PhCheck-gtpfK4ed.js +0 -73
- package/dist/PhCircleHalf-Uq7dwDYw.js +0 -73
- package/dist/PhClock-SDCW-NmF.js +0 -73
- package/dist/PhCompass-B7hgtdx-.js +0 -73
- package/dist/PhCopy-BcnhyXCy.js +0 -73
- package/dist/PhCreditCard-BJjByVgu.js +0 -73
- package/dist/PhCurrencyDollar-B7ZXqXBy.js +0 -73
- package/dist/PhDesktop-B3VKPuJx.js +0 -73
- package/dist/PhDeviceMobile-Bnd0TYEH.js +0 -73
- package/dist/PhDotsThree-yyMWyZ-R.js +0 -73
- package/dist/PhEnvelope-67uzHbI9.js +0 -73
- package/dist/PhFunnelSimple-B-DCsloI.js +0 -73
- package/dist/PhGlobe-TMm_6qGk.js +0 -73
- package/dist/PhIdentificationCard-CePPD2xc.js +0 -73
- package/dist/PhImage-gY96WtHR.js +0 -73
- package/dist/PhInfo-DRQM_ZDP.js +0 -73
- package/dist/PhLightbulb-B0TxPfZ1.js +0 -73
- package/dist/PhMagnifyingGlass-B8si5_6W.js +0 -73
- package/dist/PhPaperPlaneRight-DVu5PLYd.js +0 -73
- package/dist/PhPlus-BfTsQnUz.js +0 -73
- package/dist/PhPower-CxYUGOWn.js +0 -73
- package/dist/PhPuzzlePiece-CQ4wh0gV.js +0 -73
- package/dist/PhQrCode-BuJ97NYJ.js +0 -73
- package/dist/PhQuestion-kJoP8Mja.js +0 -73
- package/dist/PhQuestionMark-C46ZkFpu.js +0 -73
- package/dist/PhSealCheck-Eh8jVqSN.js +0 -73
- package/dist/PhSignOut-jk97OSVt.js +0 -73
- package/dist/PhSpinner-CiYOhwMg.js +0 -73
- package/dist/PhTrash-pxerMqzd.js +0 -73
- package/dist/PhUser-BMg0VV4A.js +0 -73
- package/dist/PhVault-DYQvx5A-.js +0 -73
- package/dist/PhWarning-NLC5Mj87.js +0 -73
- package/dist/PhWarningCircle-Ch2jU9fA.js +0 -73
- package/dist/PhX-Bx4wpwm3.js +0 -73
- package/dist/SwapController-Ch0FFTEt.js +0 -457
- package/dist/ccip-BrGhNXIM.js +0 -150
- package/dist/core/api.d.ts +0 -39
- package/dist/core/logic.d.ts +0 -2
- package/dist/core/wallet.d.ts +0 -55
- package/dist/data-capture-CpafmuCb.js +0 -490
- package/dist/email-Dcg4jlai.js +0 -344
- package/dist/embedded-wallet-DeoRdAPw.js +0 -820
- package/dist/features-B9Nde43h.js +0 -274
- package/dist/hashTypedData-a7b8tdkO.js +0 -197
- package/dist/if-defined-k21LutCn.js +0 -10
- package/dist/index-9vLw53Xl.js +0 -228
- package/dist/index-B5wUyynz.js +0 -107
- package/dist/index-B8LkUrww.js +0 -86
- package/dist/index-BA0VwKg0.js +0 -8189
- package/dist/index-BB9JJ24N.js +0 -125
- package/dist/index-BCkEvPQ6.js +0 -172
- package/dist/index-BDeO_csr.js +0 -171
- package/dist/index-Bb7babLF.js +0 -1281
- package/dist/index-BjOhprVS.js +0 -199
- package/dist/index-BjyMgZsf.js +0 -218
- package/dist/index-BkThIDLX.js +0 -159
- package/dist/index-BmFs6nb7.js +0 -209
- package/dist/index-C1QEJL-2.js +0 -572
- package/dist/index-C4qc4PdD.js +0 -387
- package/dist/index-CAPvUh14.js +0 -1750
- package/dist/index-CBMU3PTE.js +0 -65
- package/dist/index-CGwPkJLF.js +0 -355
- package/dist/index-CNGEqX3D.js +0 -153
- package/dist/index-CRlCq6IB.js +0 -7981
- package/dist/index-Cg_o-i9X.js +0 -118
- package/dist/index-D1BvhCbI.js +0 -62
- package/dist/index-DFi8TiHc.js +0 -128
- package/dist/index-DLwuveL9.js +0 -555
- package/dist/index-DMn7ktUQ.js +0 -56
- package/dist/index-DOXwtuwa.js +0 -117
- package/dist/index-DPPOW_Tp.js +0 -118
- package/dist/index-DQpzHpW-.js +0 -517
- package/dist/index-DXHg5C-W.js +0 -276
- package/dist/index-DcYjZV4H.js +0 -110
- package/dist/index-DeL88Lwc.js +0 -41655
- package/dist/index-DrWVlf8b.js +0 -46
- package/dist/index-Dsfuc4rB.js +0 -123
- package/dist/index-DuTny38n.js +0 -1175
- package/dist/index-Nfjb6bV0.js +0 -21991
- package/dist/index-WwwdQSN2.js +0 -85
- package/dist/index-Yha9Afch.js +0 -174
- package/dist/index-cbQHN7GC.js +0 -100
- package/dist/index-hyG3cYsv.js +0 -1083
- package/dist/index-qLxmmPaL.js +0 -257
- package/dist/localBatchGatewayRequest-vfcvRH0G.js +0 -91
- package/dist/onramp-BSiyOX4L.js +0 -855
- package/dist/parseSignature-CdCMAPZN.js +0 -3304
- package/dist/pay-with-exchange-CduNoMEz.js +0 -525
- package/dist/property-Bd8U3_QP.js +0 -618
- package/dist/receive-CrmptJlq.js +0 -232
- package/dist/ref-SOwYtCZb.js +0 -107
- package/dist/send-oMcHMEr6.js +0 -1166
- package/dist/socials-C0A4-FbY.js +0 -620
- package/dist/swaps-CbJJ9Ciu.js +0 -1760
- package/dist/transactions-BDfCoBS5.js +0 -37
- package/dist/ui/Modal.d.ts +0 -9
- package/dist/ui/index.d.ts +0 -6
- package/dist/w3m-modal-BjsTkny7.js +0 -1706
|
@@ -1,457 +0,0 @@
|
|
|
1
|
-
import { cN as T, c$ as W, cC as x, d0 as A, cH as g, d1 as B, d2 as P, cF as D, d3 as M, d4 as F, cE as w, cP as v, cG as L, d5 as N, d6 as z, d7 as R, cL as _, cO as H, d8 as V, cR as $, cS as q } from "./index-DeL88Lwc.js";
|
|
2
|
-
const I = {
|
|
3
|
-
getGasPriceInEther(n, t) {
|
|
4
|
-
const o = t * n;
|
|
5
|
-
return Number(o) / 1e18;
|
|
6
|
-
},
|
|
7
|
-
getGasPriceInUSD(n, t, o) {
|
|
8
|
-
const s = I.getGasPriceInEther(t, o);
|
|
9
|
-
return T.bigNumber(n).times(s).toNumber();
|
|
10
|
-
},
|
|
11
|
-
getPriceImpact({ sourceTokenAmount: n, sourceTokenPriceInUSD: t, toTokenPriceInUSD: o, toTokenAmount: s }) {
|
|
12
|
-
const c = T.bigNumber(n).times(t), r = T.bigNumber(s).times(o);
|
|
13
|
-
return c.minus(r).div(c).times(100).toNumber();
|
|
14
|
-
},
|
|
15
|
-
getMaxSlippage(n, t) {
|
|
16
|
-
const o = T.bigNumber(n).div(100);
|
|
17
|
-
return T.multiply(t, o).toNumber();
|
|
18
|
-
},
|
|
19
|
-
getProviderFee(n, t = 85e-4) {
|
|
20
|
-
return T.bigNumber(n).times(t).toString();
|
|
21
|
-
},
|
|
22
|
-
isInsufficientNetworkTokenForGas(n, t) {
|
|
23
|
-
const o = t || "0";
|
|
24
|
-
return T.bigNumber(n).eq(0) ? !0 : T.bigNumber(T.bigNumber(o)).gt(n);
|
|
25
|
-
},
|
|
26
|
-
isInsufficientSourceTokenForSwap(n, t, o) {
|
|
27
|
-
var r, d;
|
|
28
|
-
const s = (d = (r = o == null ? void 0 : o.find((l) => l.address === t)) == null ? void 0 : r.quantity) == null ? void 0 : d.numeric;
|
|
29
|
-
return T.bigNumber(s || "0").lt(n);
|
|
30
|
-
}
|
|
31
|
-
}, O = 15e4, Q = 6, k = {
|
|
32
|
-
// Loading states
|
|
33
|
-
initializing: !1,
|
|
34
|
-
initialized: !1,
|
|
35
|
-
loadingPrices: !1,
|
|
36
|
-
loadingQuote: !1,
|
|
37
|
-
loadingApprovalTransaction: !1,
|
|
38
|
-
loadingBuildTransaction: !1,
|
|
39
|
-
loadingTransaction: !1,
|
|
40
|
-
// Control states
|
|
41
|
-
switchingTokens: !1,
|
|
42
|
-
// Error states
|
|
43
|
-
fetchError: !1,
|
|
44
|
-
// Approval & Swap transaction states
|
|
45
|
-
approvalTransaction: void 0,
|
|
46
|
-
swapTransaction: void 0,
|
|
47
|
-
transactionError: void 0,
|
|
48
|
-
// Input values
|
|
49
|
-
sourceToken: void 0,
|
|
50
|
-
sourceTokenAmount: "",
|
|
51
|
-
sourceTokenPriceInUSD: 0,
|
|
52
|
-
toToken: void 0,
|
|
53
|
-
toTokenAmount: "",
|
|
54
|
-
toTokenPriceInUSD: 0,
|
|
55
|
-
networkPrice: "0",
|
|
56
|
-
networkBalanceInUSD: "0",
|
|
57
|
-
networkTokenSymbol: "",
|
|
58
|
-
inputError: void 0,
|
|
59
|
-
// Request values
|
|
60
|
-
slippage: _.CONVERT_SLIPPAGE_TOLERANCE,
|
|
61
|
-
// Tokens
|
|
62
|
-
tokens: void 0,
|
|
63
|
-
popularTokens: void 0,
|
|
64
|
-
suggestedTokens: void 0,
|
|
65
|
-
foundTokens: void 0,
|
|
66
|
-
myTokensWithBalance: void 0,
|
|
67
|
-
tokensPriceMap: {},
|
|
68
|
-
// Calculations
|
|
69
|
-
gasFee: "0",
|
|
70
|
-
gasPriceInUSD: 0,
|
|
71
|
-
priceImpact: void 0,
|
|
72
|
-
maxSlippage: void 0,
|
|
73
|
-
providerFee: void 0
|
|
74
|
-
}, e = x({ ...k }), E = {
|
|
75
|
-
state: e,
|
|
76
|
-
subscribe(n) {
|
|
77
|
-
return q(e, () => n(e));
|
|
78
|
-
},
|
|
79
|
-
subscribeKey(n, t) {
|
|
80
|
-
return $(e, n, t);
|
|
81
|
-
},
|
|
82
|
-
getParams() {
|
|
83
|
-
var i, u, p, f, S, h, y, b, C;
|
|
84
|
-
const n = w.state.activeChain, t = ((i = w.getAccountData(n)) == null ? void 0 : i.caipAddress) ?? w.state.activeCaipAddress, o = L.getPlainAddress(t), s = H(), c = V.getConnectorId(w.state.activeChain);
|
|
85
|
-
if (!o)
|
|
86
|
-
throw new Error("No address found to swap the tokens from.");
|
|
87
|
-
const r = !((u = e.toToken) != null && u.address) || !((p = e.toToken) != null && p.decimals), d = !((f = e.sourceToken) != null && f.address) || !((S = e.sourceToken) != null && S.decimals) || !T.bigNumber(e.sourceTokenAmount).gt(0), l = !e.sourceTokenAmount;
|
|
88
|
-
return {
|
|
89
|
-
networkAddress: s,
|
|
90
|
-
fromAddress: o,
|
|
91
|
-
fromCaipAddress: t,
|
|
92
|
-
sourceTokenAddress: (h = e.sourceToken) == null ? void 0 : h.address,
|
|
93
|
-
toTokenAddress: (y = e.toToken) == null ? void 0 : y.address,
|
|
94
|
-
toTokenAmount: e.toTokenAmount,
|
|
95
|
-
toTokenDecimals: (b = e.toToken) == null ? void 0 : b.decimals,
|
|
96
|
-
sourceTokenAmount: e.sourceTokenAmount,
|
|
97
|
-
sourceTokenDecimals: (C = e.sourceToken) == null ? void 0 : C.decimals,
|
|
98
|
-
invalidToToken: r,
|
|
99
|
-
invalidSourceToken: d,
|
|
100
|
-
invalidSourceTokenAmount: l,
|
|
101
|
-
availableToSwap: t && !r && !d && !l,
|
|
102
|
-
isAuthConnector: c === P.CONNECTOR_ID.AUTH
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
async setSourceToken(n) {
|
|
106
|
-
if (!n) {
|
|
107
|
-
e.sourceToken = n, e.sourceTokenAmount = "", e.sourceTokenPriceInUSD = 0;
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
e.sourceToken = n, await a.setTokenPrice(n.address, "sourceToken");
|
|
111
|
-
},
|
|
112
|
-
setSourceTokenAmount(n) {
|
|
113
|
-
e.sourceTokenAmount = n;
|
|
114
|
-
},
|
|
115
|
-
async setToToken(n) {
|
|
116
|
-
if (!n) {
|
|
117
|
-
e.toToken = n, e.toTokenAmount = "", e.toTokenPriceInUSD = 0;
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
e.toToken = n, await a.setTokenPrice(n.address, "toToken");
|
|
121
|
-
},
|
|
122
|
-
setToTokenAmount(n) {
|
|
123
|
-
e.toTokenAmount = n ? T.toFixed(n, Q) : "";
|
|
124
|
-
},
|
|
125
|
-
async setTokenPrice(n, t) {
|
|
126
|
-
let o = e.tokensPriceMap[n] || 0;
|
|
127
|
-
o || (e.loadingPrices = !0, o = await a.getAddressPrice(n)), t === "sourceToken" ? e.sourceTokenPriceInUSD = o : t === "toToken" && (e.toTokenPriceInUSD = o), e.loadingPrices && (e.loadingPrices = !1), a.getParams().availableToSwap && !e.switchingTokens && a.swapTokens();
|
|
128
|
-
},
|
|
129
|
-
async switchTokens() {
|
|
130
|
-
if (!(e.initializing || !e.initialized || e.switchingTokens)) {
|
|
131
|
-
e.switchingTokens = !0;
|
|
132
|
-
try {
|
|
133
|
-
const n = e.toToken ? { ...e.toToken } : void 0, t = e.sourceToken ? { ...e.sourceToken } : void 0, o = n && e.toTokenAmount === "" ? "1" : e.toTokenAmount;
|
|
134
|
-
a.setSourceTokenAmount(o), a.setToTokenAmount(""), await a.setSourceToken(n), await a.setToToken(t), e.switchingTokens = !1, a.swapTokens();
|
|
135
|
-
} catch (n) {
|
|
136
|
-
throw e.switchingTokens = !1, n;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
resetState() {
|
|
141
|
-
e.myTokensWithBalance = k.myTokensWithBalance, e.tokensPriceMap = k.tokensPriceMap, e.initialized = k.initialized, e.initializing = k.initializing, e.switchingTokens = k.switchingTokens, e.sourceToken = k.sourceToken, e.sourceTokenAmount = k.sourceTokenAmount, e.sourceTokenPriceInUSD = k.sourceTokenPriceInUSD, e.toToken = k.toToken, e.toTokenAmount = k.toTokenAmount, e.toTokenPriceInUSD = k.toTokenPriceInUSD, e.networkPrice = k.networkPrice, e.networkTokenSymbol = k.networkTokenSymbol, e.networkBalanceInUSD = k.networkBalanceInUSD, e.inputError = k.inputError;
|
|
142
|
-
},
|
|
143
|
-
resetValues() {
|
|
144
|
-
var o;
|
|
145
|
-
const { networkAddress: n } = a.getParams(), t = (o = e.tokens) == null ? void 0 : o.find((s) => s.address === n);
|
|
146
|
-
a.setSourceToken(t), a.setToToken(void 0);
|
|
147
|
-
},
|
|
148
|
-
getApprovalLoadingState() {
|
|
149
|
-
return e.loadingApprovalTransaction;
|
|
150
|
-
},
|
|
151
|
-
clearError() {
|
|
152
|
-
e.transactionError = void 0;
|
|
153
|
-
},
|
|
154
|
-
async initializeState() {
|
|
155
|
-
if (!e.initializing) {
|
|
156
|
-
if (e.initializing = !0, !e.initialized)
|
|
157
|
-
try {
|
|
158
|
-
await a.fetchTokens(), e.initialized = !0;
|
|
159
|
-
} catch {
|
|
160
|
-
e.initialized = !1, g.showError("Failed to initialize swap"), A.goBack();
|
|
161
|
-
}
|
|
162
|
-
e.initializing = !1;
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
async fetchTokens() {
|
|
166
|
-
var o;
|
|
167
|
-
const { networkAddress: n } = a.getParams();
|
|
168
|
-
await a.getNetworkTokenPrice(), await a.getMyTokensWithBalance();
|
|
169
|
-
const t = (o = e.myTokensWithBalance) == null ? void 0 : o.find((s) => s.address === n);
|
|
170
|
-
t && (e.networkTokenSymbol = t.symbol, a.setSourceToken(t), a.setSourceTokenAmount("0"));
|
|
171
|
-
},
|
|
172
|
-
async getTokenList() {
|
|
173
|
-
var t, o;
|
|
174
|
-
const n = (t = w.state.activeCaipNetwork) == null ? void 0 : t.caipNetworkId;
|
|
175
|
-
if (!(e.caipNetworkId === n && e.tokens))
|
|
176
|
-
try {
|
|
177
|
-
e.tokensLoading = !0;
|
|
178
|
-
const s = await N.getTokenList(n);
|
|
179
|
-
e.tokens = s, e.caipNetworkId = n, e.popularTokens = s.sort((i, u) => i.symbol < u.symbol ? -1 : i.symbol > u.symbol ? 1 : 0);
|
|
180
|
-
const r = (n && ((o = _.SUGGESTED_TOKENS_BY_CHAIN) == null ? void 0 : o[n]) || []).map((i) => s.find((u) => u.symbol === i)).filter((i) => !!i), l = (_.SWAP_SUGGESTED_TOKENS || []).map((i) => s.find((u) => u.symbol === i)).filter((i) => !!i).filter((i) => !r.some((u) => u.address === i.address));
|
|
181
|
-
e.suggestedTokens = [...r, ...l];
|
|
182
|
-
} catch {
|
|
183
|
-
e.tokens = [], e.popularTokens = [], e.suggestedTokens = [];
|
|
184
|
-
} finally {
|
|
185
|
-
e.tokensLoading = !1;
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
async getAddressPrice(n) {
|
|
189
|
-
var i, u;
|
|
190
|
-
const t = e.tokensPriceMap[n];
|
|
191
|
-
if (t)
|
|
192
|
-
return t;
|
|
193
|
-
const o = await v.fetchTokenPrice({
|
|
194
|
-
addresses: [n]
|
|
195
|
-
}), s = (o == null ? void 0 : o.fungibles) || [], c = [...e.tokens || [], ...e.myTokensWithBalance || []], r = (i = c == null ? void 0 : c.find((p) => p.address === n)) == null ? void 0 : i.symbol, d = ((u = s.find((p) => p.symbol.toLowerCase() === (r == null ? void 0 : r.toLowerCase()))) == null ? void 0 : u.price) || 0, l = parseFloat(d.toString());
|
|
196
|
-
return e.tokensPriceMap[n] = l, l;
|
|
197
|
-
},
|
|
198
|
-
async getNetworkTokenPrice() {
|
|
199
|
-
var c;
|
|
200
|
-
const { networkAddress: n } = a.getParams(), o = (c = (await v.fetchTokenPrice({
|
|
201
|
-
addresses: [n]
|
|
202
|
-
}).catch(() => (g.showError("Failed to fetch network token price"), { fungibles: [] }))).fungibles) == null ? void 0 : c[0], s = (o == null ? void 0 : o.price.toString()) || "0";
|
|
203
|
-
e.tokensPriceMap[n] = parseFloat(s), e.networkTokenSymbol = (o == null ? void 0 : o.symbol) || "", e.networkPrice = s;
|
|
204
|
-
},
|
|
205
|
-
async getMyTokensWithBalance(n) {
|
|
206
|
-
const t = await R.getMyTokensWithBalance(n), o = N.mapBalancesToSwapTokens(t);
|
|
207
|
-
o && (await a.getInitialGasPrice(), a.setBalances(o));
|
|
208
|
-
},
|
|
209
|
-
setBalances(n) {
|
|
210
|
-
const { networkAddress: t } = a.getParams(), o = w.state.activeCaipNetwork;
|
|
211
|
-
if (!o)
|
|
212
|
-
return;
|
|
213
|
-
const s = n.find((c) => c.address === t);
|
|
214
|
-
n.forEach((c) => {
|
|
215
|
-
e.tokensPriceMap[c.address] = c.price || 0;
|
|
216
|
-
}), e.myTokensWithBalance = n.filter((c) => c.address.startsWith(o.caipNetworkId)), e.networkBalanceInUSD = s ? T.multiply(s.quantity.numeric, s.price).toString() : "0";
|
|
217
|
-
},
|
|
218
|
-
async getInitialGasPrice() {
|
|
219
|
-
var t, o;
|
|
220
|
-
const n = await N.fetchGasPrice();
|
|
221
|
-
if (!n)
|
|
222
|
-
return { gasPrice: null, gasPriceInUSD: null };
|
|
223
|
-
switch ((o = (t = w.state) == null ? void 0 : t.activeCaipNetwork) == null ? void 0 : o.chainNamespace) {
|
|
224
|
-
case P.CHAIN.SOLANA:
|
|
225
|
-
return e.gasFee = n.standard ?? "0", e.gasPriceInUSD = T.multiply(n.standard, e.networkPrice).div(1e9).toNumber(), {
|
|
226
|
-
gasPrice: BigInt(e.gasFee),
|
|
227
|
-
gasPriceInUSD: Number(e.gasPriceInUSD)
|
|
228
|
-
};
|
|
229
|
-
case P.CHAIN.EVM:
|
|
230
|
-
default:
|
|
231
|
-
const s = n.standard ?? "0", c = BigInt(s), r = BigInt(O), d = I.getGasPriceInUSD(e.networkPrice, r, c);
|
|
232
|
-
return e.gasFee = s, e.gasPriceInUSD = d, { gasPrice: c, gasPriceInUSD: d };
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
// -- Swap -------------------------------------- //
|
|
236
|
-
async swapTokens() {
|
|
237
|
-
var r, d, l;
|
|
238
|
-
const n = (r = w.getAccountData()) == null ? void 0 : r.address, t = e.sourceToken, o = e.toToken, s = T.bigNumber(e.sourceTokenAmount).gt(0);
|
|
239
|
-
if (s || a.setToTokenAmount(""), !o || !t || e.loadingPrices || !s || !n)
|
|
240
|
-
return;
|
|
241
|
-
e.loadingQuote = !0;
|
|
242
|
-
const c = T.bigNumber(e.sourceTokenAmount).times(10 ** t.decimals).round(0);
|
|
243
|
-
try {
|
|
244
|
-
const i = await v.fetchSwapQuote({
|
|
245
|
-
userAddress: n,
|
|
246
|
-
from: t.address,
|
|
247
|
-
to: o.address,
|
|
248
|
-
gasPrice: e.gasFee,
|
|
249
|
-
amount: c.toString()
|
|
250
|
-
});
|
|
251
|
-
e.loadingQuote = !1;
|
|
252
|
-
const u = (l = (d = i == null ? void 0 : i.quotes) == null ? void 0 : d[0]) == null ? void 0 : l.toAmount;
|
|
253
|
-
if (!u) {
|
|
254
|
-
z.open({
|
|
255
|
-
displayMessage: "Incorrect amount",
|
|
256
|
-
debugMessage: "Please enter a valid amount"
|
|
257
|
-
}, "error");
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
const p = T.bigNumber(u).div(10 ** o.decimals).toString();
|
|
261
|
-
a.setToTokenAmount(p), a.hasInsufficientToken(e.sourceTokenAmount, t.address) ? e.inputError = "Insufficient balance" : (e.inputError = void 0, a.setTransactionDetails());
|
|
262
|
-
} catch (i) {
|
|
263
|
-
const u = await N.handleSwapError(i);
|
|
264
|
-
e.loadingQuote = !1, e.inputError = u || "Insufficient balance";
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
// -- Create Transactions -------------------------------------- //
|
|
268
|
-
async getTransaction() {
|
|
269
|
-
const { fromCaipAddress: n, availableToSwap: t } = a.getParams(), o = e.sourceToken, s = e.toToken;
|
|
270
|
-
if (!(!n || !t || !o || !s || e.loadingQuote))
|
|
271
|
-
try {
|
|
272
|
-
e.loadingBuildTransaction = !0;
|
|
273
|
-
const c = await N.fetchSwapAllowance({
|
|
274
|
-
userAddress: n,
|
|
275
|
-
tokenAddress: o.address,
|
|
276
|
-
sourceTokenAmount: e.sourceTokenAmount,
|
|
277
|
-
sourceTokenDecimals: o.decimals
|
|
278
|
-
});
|
|
279
|
-
let r;
|
|
280
|
-
return c ? r = await a.createSwapTransaction() : r = await a.createAllowanceTransaction(), e.loadingBuildTransaction = !1, e.fetchError = !1, r;
|
|
281
|
-
} catch {
|
|
282
|
-
A.goBack(), g.showError("Failed to check allowance"), e.loadingBuildTransaction = !1, e.approvalTransaction = void 0, e.swapTransaction = void 0, e.fetchError = !0;
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
async createAllowanceTransaction() {
|
|
287
|
-
const { fromCaipAddress: n, sourceTokenAddress: t, toTokenAddress: o } = a.getParams();
|
|
288
|
-
if (!(!n || !o)) {
|
|
289
|
-
if (!t)
|
|
290
|
-
throw new Error("createAllowanceTransaction - No source token address found.");
|
|
291
|
-
try {
|
|
292
|
-
const s = await v.generateApproveCalldata({
|
|
293
|
-
from: t,
|
|
294
|
-
to: o,
|
|
295
|
-
userAddress: n
|
|
296
|
-
}), c = L.getPlainAddress(s.tx.from);
|
|
297
|
-
if (!c)
|
|
298
|
-
throw new Error("SwapController:createAllowanceTransaction - address is required");
|
|
299
|
-
const r = {
|
|
300
|
-
data: s.tx.data,
|
|
301
|
-
to: c,
|
|
302
|
-
gasPrice: BigInt(s.tx.eip155.gasPrice),
|
|
303
|
-
value: BigInt(s.tx.value),
|
|
304
|
-
toAmount: e.toTokenAmount
|
|
305
|
-
};
|
|
306
|
-
return e.swapTransaction = void 0, e.approvalTransaction = {
|
|
307
|
-
data: r.data,
|
|
308
|
-
to: r.to,
|
|
309
|
-
gasPrice: r.gasPrice,
|
|
310
|
-
value: r.value,
|
|
311
|
-
toAmount: r.toAmount
|
|
312
|
-
}, {
|
|
313
|
-
data: r.data,
|
|
314
|
-
to: r.to,
|
|
315
|
-
gasPrice: r.gasPrice,
|
|
316
|
-
value: r.value,
|
|
317
|
-
toAmount: r.toAmount
|
|
318
|
-
};
|
|
319
|
-
} catch {
|
|
320
|
-
A.goBack(), g.showError("Failed to create approval transaction"), e.approvalTransaction = void 0, e.swapTransaction = void 0, e.fetchError = !0;
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
async createSwapTransaction() {
|
|
326
|
-
var d;
|
|
327
|
-
const { networkAddress: n, fromCaipAddress: t, sourceTokenAmount: o } = a.getParams(), s = e.sourceToken, c = e.toToken;
|
|
328
|
-
if (!t || !o || !s || !c)
|
|
329
|
-
return;
|
|
330
|
-
const r = (d = B.parseUnits(o, s.decimals)) == null ? void 0 : d.toString();
|
|
331
|
-
try {
|
|
332
|
-
const l = await v.generateSwapCalldata({
|
|
333
|
-
userAddress: t,
|
|
334
|
-
from: s.address,
|
|
335
|
-
to: c.address,
|
|
336
|
-
amount: r,
|
|
337
|
-
disableEstimate: !0
|
|
338
|
-
}), i = s.address === n, u = BigInt(l.tx.eip155.gas), p = BigInt(l.tx.eip155.gasPrice), f = L.getPlainAddress(l.tx.to);
|
|
339
|
-
if (!f)
|
|
340
|
-
throw new Error("SwapController:createSwapTransaction - address is required");
|
|
341
|
-
const S = {
|
|
342
|
-
data: l.tx.data,
|
|
343
|
-
to: f,
|
|
344
|
-
gas: u,
|
|
345
|
-
gasPrice: p,
|
|
346
|
-
value: BigInt(i ? r ?? "0" : "0"),
|
|
347
|
-
toAmount: e.toTokenAmount
|
|
348
|
-
};
|
|
349
|
-
return e.gasPriceInUSD = I.getGasPriceInUSD(e.networkPrice, u, p), e.approvalTransaction = void 0, e.swapTransaction = S, S;
|
|
350
|
-
} catch {
|
|
351
|
-
A.goBack(), g.showError("Failed to create transaction"), e.approvalTransaction = void 0, e.swapTransaction = void 0, e.fetchError = !0;
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
onEmbeddedWalletApprovalSuccess() {
|
|
356
|
-
g.showLoading("Approve limit increase in your wallet"), A.replace("SwapPreview");
|
|
357
|
-
},
|
|
358
|
-
// -- Send Transactions --------------------------------- //
|
|
359
|
-
async sendTransactionForApproval(n) {
|
|
360
|
-
var c, r, d;
|
|
361
|
-
const { fromAddress: t, isAuthConnector: o } = a.getParams();
|
|
362
|
-
e.loadingApprovalTransaction = !0, o ? A.pushTransactionStack({
|
|
363
|
-
onSuccess: a.onEmbeddedWalletApprovalSuccess
|
|
364
|
-
}) : g.showLoading("Approve limit increase in your wallet");
|
|
365
|
-
try {
|
|
366
|
-
await B.sendTransaction({
|
|
367
|
-
address: t,
|
|
368
|
-
to: n.to,
|
|
369
|
-
data: n.data,
|
|
370
|
-
value: n.value,
|
|
371
|
-
chainNamespace: P.CHAIN.EVM
|
|
372
|
-
}), await a.swapTokens(), await a.getTransaction(), e.approvalTransaction = void 0, e.loadingApprovalTransaction = !1;
|
|
373
|
-
} catch (l) {
|
|
374
|
-
const i = l;
|
|
375
|
-
e.transactionError = i == null ? void 0 : i.displayMessage, e.loadingApprovalTransaction = !1, g.showError((i == null ? void 0 : i.displayMessage) || "Transaction error"), D.sendEvent({
|
|
376
|
-
type: "track",
|
|
377
|
-
event: "SWAP_APPROVAL_ERROR",
|
|
378
|
-
properties: {
|
|
379
|
-
message: (i == null ? void 0 : i.displayMessage) || (i == null ? void 0 : i.message) || "Unknown",
|
|
380
|
-
network: ((c = w.state.activeCaipNetwork) == null ? void 0 : c.caipNetworkId) || "",
|
|
381
|
-
swapFromToken: ((r = a.state.sourceToken) == null ? void 0 : r.symbol) || "",
|
|
382
|
-
swapToToken: ((d = a.state.toToken) == null ? void 0 : d.symbol) || "",
|
|
383
|
-
swapFromAmount: a.state.sourceTokenAmount || "",
|
|
384
|
-
swapToAmount: a.state.toTokenAmount || "",
|
|
385
|
-
isSmartAccount: M(P.CHAIN.EVM) === F.ACCOUNT_TYPES.SMART_ACCOUNT
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
async sendTransactionForSwap(n) {
|
|
391
|
-
var d, l, i, u, p, f, S, h, y, b, C, G;
|
|
392
|
-
if (!n)
|
|
393
|
-
return;
|
|
394
|
-
const { fromAddress: t, toTokenAmount: o, isAuthConnector: s } = a.getParams();
|
|
395
|
-
e.loadingTransaction = !0;
|
|
396
|
-
const c = `Swapping ${(d = e.sourceToken) == null ? void 0 : d.symbol} to ${T.formatNumberToLocalString(o, 3)} ${(l = e.toToken) == null ? void 0 : l.symbol}`, r = `Swapped ${(i = e.sourceToken) == null ? void 0 : i.symbol} to ${T.formatNumberToLocalString(o, 3)} ${(u = e.toToken) == null ? void 0 : u.symbol}`;
|
|
397
|
-
s ? A.pushTransactionStack({
|
|
398
|
-
onSuccess() {
|
|
399
|
-
A.replace("Account"), g.showLoading(c), E.resetState();
|
|
400
|
-
}
|
|
401
|
-
}) : g.showLoading("Confirm transaction in your wallet");
|
|
402
|
-
try {
|
|
403
|
-
const U = [(p = e.sourceToken) == null ? void 0 : p.address, (f = e.toToken) == null ? void 0 : f.address].join(","), m = await B.sendTransaction({
|
|
404
|
-
address: t,
|
|
405
|
-
to: n.to,
|
|
406
|
-
data: n.data,
|
|
407
|
-
value: n.value,
|
|
408
|
-
chainNamespace: P.CHAIN.EVM
|
|
409
|
-
});
|
|
410
|
-
return e.loadingTransaction = !1, g.showSuccess(r), D.sendEvent({
|
|
411
|
-
type: "track",
|
|
412
|
-
event: "SWAP_SUCCESS",
|
|
413
|
-
properties: {
|
|
414
|
-
network: ((S = w.state.activeCaipNetwork) == null ? void 0 : S.caipNetworkId) || "",
|
|
415
|
-
swapFromToken: ((h = a.state.sourceToken) == null ? void 0 : h.symbol) || "",
|
|
416
|
-
swapToToken: ((y = a.state.toToken) == null ? void 0 : y.symbol) || "",
|
|
417
|
-
swapFromAmount: a.state.sourceTokenAmount || "",
|
|
418
|
-
swapToAmount: a.state.toTokenAmount || "",
|
|
419
|
-
isSmartAccount: M(P.CHAIN.EVM) === F.ACCOUNT_TYPES.SMART_ACCOUNT
|
|
420
|
-
}
|
|
421
|
-
}), E.resetState(), s || A.replace("Account"), E.getMyTokensWithBalance(U), m;
|
|
422
|
-
} catch (U) {
|
|
423
|
-
const m = U;
|
|
424
|
-
e.transactionError = m == null ? void 0 : m.displayMessage, e.loadingTransaction = !1, g.showError((m == null ? void 0 : m.displayMessage) || "Transaction error"), D.sendEvent({
|
|
425
|
-
type: "track",
|
|
426
|
-
event: "SWAP_ERROR",
|
|
427
|
-
properties: {
|
|
428
|
-
message: (m == null ? void 0 : m.displayMessage) || (m == null ? void 0 : m.message) || "Unknown",
|
|
429
|
-
network: ((b = w.state.activeCaipNetwork) == null ? void 0 : b.caipNetworkId) || "",
|
|
430
|
-
swapFromToken: ((C = a.state.sourceToken) == null ? void 0 : C.symbol) || "",
|
|
431
|
-
swapToToken: ((G = a.state.toToken) == null ? void 0 : G.symbol) || "",
|
|
432
|
-
swapFromAmount: a.state.sourceTokenAmount || "",
|
|
433
|
-
swapToAmount: a.state.toTokenAmount || "",
|
|
434
|
-
isSmartAccount: M(P.CHAIN.EVM) === F.ACCOUNT_TYPES.SMART_ACCOUNT
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
},
|
|
440
|
-
// -- Checks -------------------------------------------- //
|
|
441
|
-
hasInsufficientToken(n, t) {
|
|
442
|
-
return I.isInsufficientSourceTokenForSwap(n, t, e.myTokensWithBalance);
|
|
443
|
-
},
|
|
444
|
-
// -- Calculations -------------------------------------- //
|
|
445
|
-
setTransactionDetails() {
|
|
446
|
-
const { toTokenAddress: n, toTokenDecimals: t } = a.getParams();
|
|
447
|
-
!n || !t || (e.gasPriceInUSD = I.getGasPriceInUSD(e.networkPrice, BigInt(e.gasFee), BigInt(O)), e.priceImpact = I.getPriceImpact({
|
|
448
|
-
sourceTokenAmount: e.sourceTokenAmount,
|
|
449
|
-
sourceTokenPriceInUSD: e.sourceTokenPriceInUSD,
|
|
450
|
-
toTokenPriceInUSD: e.toTokenPriceInUSD,
|
|
451
|
-
toTokenAmount: e.toTokenAmount
|
|
452
|
-
}), e.maxSlippage = I.getMaxSlippage(e.slippage, e.toTokenAmount), e.providerFee = I.getProviderFee(e.sourceTokenAmount));
|
|
453
|
-
}
|
|
454
|
-
}, a = W(E);
|
|
455
|
-
export {
|
|
456
|
-
a as S
|
|
457
|
-
};
|
package/dist/ccip-BrGhNXIM.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { a1 as p, dd as y, cq as w, bf as g, br as k, de as E, bB as L, bi as O, aA as m, bE as x } from "./index-DeL88Lwc.js";
|
|
2
|
-
import { l as R, b as M } from "./localBatchGatewayRequest-vfcvRH0G.js";
|
|
3
|
-
class q extends p {
|
|
4
|
-
constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
|
|
5
|
-
var o;
|
|
6
|
-
super(a.shortMessage || "An error occurred while fetching for an offchain result.", {
|
|
7
|
-
cause: a,
|
|
8
|
-
metaMessages: [
|
|
9
|
-
...a.metaMessages || [],
|
|
10
|
-
(o = a.metaMessages) != null && o.length ? "" : [],
|
|
11
|
-
"Offchain Gateway Call:",
|
|
12
|
-
t && [
|
|
13
|
-
" Gateway URL(s):",
|
|
14
|
-
...t.map((d) => ` ${y(d)}`)
|
|
15
|
-
],
|
|
16
|
-
` Sender: ${f}`,
|
|
17
|
-
` Data: ${n}`,
|
|
18
|
-
` Callback selector: ${r}`,
|
|
19
|
-
` Extra data: ${i}`
|
|
20
|
-
].flat(),
|
|
21
|
-
name: "OffchainLookupError"
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
class S extends p {
|
|
26
|
-
constructor({ result: r, url: a }) {
|
|
27
|
-
super("Offchain gateway response is malformed. Response data must be a hex value.", {
|
|
28
|
-
metaMessages: [
|
|
29
|
-
`Gateway URL: ${y(a)}`,
|
|
30
|
-
`Response: ${w(r)}`
|
|
31
|
-
],
|
|
32
|
-
name: "OffchainLookupResponseMalformedError"
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
class $ extends p {
|
|
37
|
-
constructor({ sender: r, to: a }) {
|
|
38
|
-
super("Reverted sender address does not match target contract address (`to`).", {
|
|
39
|
-
metaMessages: [
|
|
40
|
-
`Contract address: ${a}`,
|
|
41
|
-
`OffchainLookup sender address: ${r}`
|
|
42
|
-
],
|
|
43
|
-
name: "OffchainLookupSenderMismatchError"
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const D = "0x556f1830", T = {
|
|
48
|
-
name: "OffchainLookup",
|
|
49
|
-
type: "error",
|
|
50
|
-
inputs: [
|
|
51
|
-
{
|
|
52
|
-
name: "sender",
|
|
53
|
-
type: "address"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
name: "urls",
|
|
57
|
-
type: "string[]"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
name: "callData",
|
|
61
|
-
type: "bytes"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "callbackFunction",
|
|
65
|
-
type: "bytes4"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "extraData",
|
|
69
|
-
type: "bytes"
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
};
|
|
73
|
-
async function B(c, { blockNumber: r, blockTag: a, data: n, to: i }) {
|
|
74
|
-
const { args: f } = g({
|
|
75
|
-
data: n,
|
|
76
|
-
abi: [T]
|
|
77
|
-
}), [t, o, d, l, s] = f, { ccipRead: e } = c, h = e && typeof (e == null ? void 0 : e.request) == "function" ? e.request : A;
|
|
78
|
-
try {
|
|
79
|
-
if (!k(i, t))
|
|
80
|
-
throw new $({ sender: t, to: i });
|
|
81
|
-
const u = o.includes(R) ? await M({
|
|
82
|
-
data: d,
|
|
83
|
-
ccipRequest: h
|
|
84
|
-
}) : await h({ data: d, sender: t, urls: o }), { data: b } = await E(c, {
|
|
85
|
-
blockNumber: r,
|
|
86
|
-
blockTag: a,
|
|
87
|
-
data: L([
|
|
88
|
-
l,
|
|
89
|
-
O([{ type: "bytes" }, { type: "bytes" }], [u, s])
|
|
90
|
-
]),
|
|
91
|
-
to: i
|
|
92
|
-
});
|
|
93
|
-
return b;
|
|
94
|
-
} catch (u) {
|
|
95
|
-
throw new q({
|
|
96
|
-
callbackSelector: l,
|
|
97
|
-
cause: u,
|
|
98
|
-
data: n,
|
|
99
|
-
extraData: s,
|
|
100
|
-
sender: t,
|
|
101
|
-
urls: o
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
async function A({ data: c, sender: r, urls: a }) {
|
|
106
|
-
var i;
|
|
107
|
-
let n = new Error("An unknown error occurred.");
|
|
108
|
-
for (let f = 0; f < a.length; f++) {
|
|
109
|
-
const t = a[f], o = t.includes("{data}") ? "GET" : "POST", d = o === "POST" ? { data: c, sender: r } : void 0, l = o === "POST" ? { "Content-Type": "application/json" } : {};
|
|
110
|
-
try {
|
|
111
|
-
const s = await fetch(t.replace("{sender}", r.toLowerCase()).replace("{data}", c), {
|
|
112
|
-
body: JSON.stringify(d),
|
|
113
|
-
headers: l,
|
|
114
|
-
method: o
|
|
115
|
-
});
|
|
116
|
-
let e;
|
|
117
|
-
if ((i = s.headers.get("Content-Type")) != null && i.startsWith("application/json") ? e = (await s.json()).data : e = await s.text(), !s.ok) {
|
|
118
|
-
n = new m({
|
|
119
|
-
body: d,
|
|
120
|
-
details: e != null && e.error ? w(e.error) : s.statusText,
|
|
121
|
-
headers: s.headers,
|
|
122
|
-
status: s.status,
|
|
123
|
-
url: t
|
|
124
|
-
});
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
if (!x(e)) {
|
|
128
|
-
n = new S({
|
|
129
|
-
result: e,
|
|
130
|
-
url: t
|
|
131
|
-
});
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
return e;
|
|
135
|
-
} catch (s) {
|
|
136
|
-
n = new m({
|
|
137
|
-
body: d,
|
|
138
|
-
details: s.message,
|
|
139
|
-
url: t
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
throw n;
|
|
144
|
-
}
|
|
145
|
-
export {
|
|
146
|
-
A as ccipRequest,
|
|
147
|
-
B as offchainLookup,
|
|
148
|
-
T as offchainLookupAbiItem,
|
|
149
|
-
D as offchainLookupSignature
|
|
150
|
-
};
|
package/dist/core/api.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ToolData, BackendIntentResponse, IntegrationConfig, IntegrationIntentResponse } from '../types';
|
|
2
|
-
export interface SubmitPaymentRequest {
|
|
3
|
-
tx_hash: string;
|
|
4
|
-
chain_id: number;
|
|
5
|
-
amount_wei: string;
|
|
6
|
-
token_address: string;
|
|
7
|
-
recipient: string;
|
|
8
|
-
metadata?: Record<string, any>;
|
|
9
|
-
}
|
|
10
|
-
export interface SubmitPaymentResponse {
|
|
11
|
-
payment_id: string;
|
|
12
|
-
tx_hash: string;
|
|
13
|
-
status: 'pending' | 'confirmed' | 'failed';
|
|
14
|
-
message: string;
|
|
15
|
-
}
|
|
16
|
-
export interface PaymentStatusResponse {
|
|
17
|
-
payment_id: string;
|
|
18
|
-
tx_hash: string;
|
|
19
|
-
chain_id: number;
|
|
20
|
-
status: 'pending' | 'confirmed' | 'failed';
|
|
21
|
-
verified_at: string | null;
|
|
22
|
-
metadata?: Record<string, any>;
|
|
23
|
-
}
|
|
24
|
-
export declare class API {
|
|
25
|
-
fetchTool(toolId: string): Promise<ToolData>;
|
|
26
|
-
createIntent(toolId: string, tokenSymbol: string): Promise<BackendIntentResponse>;
|
|
27
|
-
submitPayment(request: SubmitPaymentRequest, toolId?: string): Promise<SubmitPaymentResponse>;
|
|
28
|
-
getPaymentStatus(paymentId: string, toolId?: string): Promise<PaymentStatusResponse>;
|
|
29
|
-
fetchIntegrationConfig(integrationId: string): Promise<IntegrationConfig>;
|
|
30
|
-
createIntegrationIntent(integrationId: string, data: {
|
|
31
|
-
amount?: string | number;
|
|
32
|
-
amount_usd?: string;
|
|
33
|
-
currency: string;
|
|
34
|
-
chainId: number;
|
|
35
|
-
metadata?: Record<string, any>;
|
|
36
|
-
}): Promise<IntegrationIntentResponse>;
|
|
37
|
-
declareIntegrationTx(integrationId: string, intentId: string, txHash: string): Promise<any>;
|
|
38
|
-
}
|
|
39
|
-
export declare const api: API;
|
package/dist/core/logic.d.ts
DELETED