@ape.swap/bonds-sdk 4.1.0-test.11 → 4.1.0-test.12
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/dist/main.js +23 -17
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -75445,6 +75445,7 @@ const YourBondsModalSolana = ({ billId, onDismiss }) => {
|
|
|
75445
75445
|
const UserBondRowSolana = ({ bill }) => {
|
|
75446
75446
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
75447
75447
|
// Hooks
|
|
75448
|
+
const SDKConfig = useSDKConfig();
|
|
75448
75449
|
const { setVisible } = useWalletModal();
|
|
75449
75450
|
const { publicKey: accountSolana, signTransaction } = useSOLAccount();
|
|
75450
75451
|
const { addToastError, addToastSuccess } = usePopups();
|
|
@@ -75490,7 +75491,7 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75490
75491
|
return userPayoutAta;
|
|
75491
75492
|
});
|
|
75492
75493
|
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
75493
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
75494
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
75494
75495
|
try {
|
|
75495
75496
|
setLoadingTx(true);
|
|
75496
75497
|
const earnTokenAddress = (_c = (_b = (_a = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _a === void 0 ? void 0 : _a.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[(_d = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _d === void 0 ? void 0 : _d.chainId];
|
|
@@ -75558,6 +75559,11 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75558
75559
|
catch (error) {
|
|
75559
75560
|
console.error('Claim failed:', error);
|
|
75560
75561
|
addToastError((_k = error === null || error === void 0 ? void 0 : error.message) !== null && _k !== void 0 ? _k : 'Unknown error');
|
|
75562
|
+
reportError({
|
|
75563
|
+
apiUrl: (_l = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _l === void 0 ? void 0 : _l.apiV2,
|
|
75564
|
+
error,
|
|
75565
|
+
extraInfo: { type: 'claim', bill, error },
|
|
75566
|
+
});
|
|
75561
75567
|
}
|
|
75562
75568
|
finally {
|
|
75563
75569
|
setLoadingTx(false);
|
|
@@ -85111,7 +85117,7 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
|
|
|
85111
85117
|
setInputTokenString(newInputToken);
|
|
85112
85118
|
}, []);
|
|
85113
85119
|
const handleBuyCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
85114
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
85120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
85115
85121
|
if (!accountSolana || !bondData || !inputValue || !inputToken || !bondData)
|
|
85116
85122
|
return;
|
|
85117
85123
|
track({
|
|
@@ -85213,30 +85219,30 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
|
|
|
85213
85219
|
blockhash,
|
|
85214
85220
|
lastValidBlockHeight,
|
|
85215
85221
|
}, 'confirmed');
|
|
85216
|
-
|
|
85217
|
-
|
|
85218
|
-
|
|
85219
|
-
|
|
85220
|
-
|
|
85221
|
-
|
|
85222
|
-
|
|
85222
|
+
console.log('tx confirmed');
|
|
85223
|
+
// axios
|
|
85224
|
+
// .post(`${SDKConfig?.urls?.apiV2}/bills/solana/ingest`, {
|
|
85225
|
+
// signature: txId,
|
|
85226
|
+
// })
|
|
85227
|
+
// .catch((e) => {
|
|
85228
|
+
// console.error(e)
|
|
85229
|
+
// })
|
|
85223
85230
|
track({
|
|
85224
85231
|
event: 'bond',
|
|
85225
85232
|
chain: bondChain,
|
|
85226
85233
|
data: {
|
|
85227
85234
|
cat: 'lp-buy',
|
|
85228
|
-
type: (
|
|
85235
|
+
type: (_d = bondData === null || bondData === void 0 ? void 0 : bondData.billType) !== null && _d !== void 0 ? _d : '',
|
|
85229
85236
|
typedValue: inputValue,
|
|
85230
|
-
principalToken: (
|
|
85231
|
-
earnToken: (
|
|
85232
|
-
address: remove0xPrefix((
|
|
85233
|
-
usdAmount: parseFloat(inputValue) * ((
|
|
85237
|
+
principalToken: (_e = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken.symbol) !== null && _e !== void 0 ? _e : '',
|
|
85238
|
+
earnToken: (_f = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol) !== null && _f !== void 0 ? _f : '',
|
|
85239
|
+
address: remove0xPrefix((_g = bondData === null || bondData === void 0 ? void 0 : bondData.contractAddress) === null || _g === void 0 ? void 0 : _g[bondData.chainId]),
|
|
85240
|
+
usdAmount: parseFloat(inputValue) * ((_h = inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) !== null && _h !== void 0 ? _h : 0),
|
|
85234
85241
|
},
|
|
85235
85242
|
});
|
|
85236
|
-
console.time('asd');
|
|
85237
85243
|
// waits 3 seconds before triggering after-purchase flow
|
|
85238
85244
|
yield new Promise((resolve) => setTimeout(resolve, 3000));
|
|
85239
|
-
console.timeEnd('
|
|
85245
|
+
console.timeEnd('3 seconds elapsed. trigger bonds refetch');
|
|
85240
85246
|
addToastSuccess(txId, bondChain);
|
|
85241
85247
|
setBillId === null || setBillId === void 0 ? void 0 : setBillId(nftMint.publicKey.toString());
|
|
85242
85248
|
}
|
|
@@ -85244,7 +85250,7 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
|
|
|
85244
85250
|
console.error('Error during bond purchase:', error);
|
|
85245
85251
|
addToastError((error === null || error === void 0 ? void 0 : error.message) || 'Unknown error');
|
|
85246
85252
|
reportError$1({
|
|
85247
|
-
apiUrl: (
|
|
85253
|
+
apiUrl: (_j = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _j === void 0 ? void 0 : _j.apiV2,
|
|
85248
85254
|
error: error.message,
|
|
85249
85255
|
extraInfo: { type: 'solanaBuyBond', error: error.message },
|
|
85250
85256
|
chainId: bondChain,
|