@b3dotfun/sdk 0.0.41 → 0.0.42-alpha.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.
- package/dist/cjs/anyspend/react/components/AnySpend.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpend.js +18 -2
- package/dist/cjs/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +76 -14
- package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/cjs/anyspend/react/components/AnySpendStakeB3.js +0 -1
- package/dist/cjs/anyspend/react/components/AnyspendSignatureMint.js +1 -2
- package/dist/cjs/anyspend/react/components/common/CryptoPaySection.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoReceiveSection.js +2 -1
- package/dist/cjs/anyspend/react/components/common/PanelOnramp.js +4 -1
- package/dist/cjs/anyspend/react/components/common/PointsBadge.d.ts +7 -0
- package/dist/cjs/anyspend/react/components/common/PointsBadge.js +7 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendFlow.js +5 -3
- package/dist/cjs/anyspend/services/anyspend.d.ts +1 -1
- package/dist/cjs/anyspend/services/anyspend.js +2 -0
- package/dist/cjs/anyspend/types/api.d.ts +41 -1
- package/dist/cjs/anyspend/utils/orderPayload.js +3 -0
- package/dist/cjs/bondkit/components/TradingView.js +3 -4
- package/dist/cjs/bondkit/swapService.js +3 -0
- package/dist/cjs/global-account/react/components/B3Provider/B3Provider.js +19 -13
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -0
- package/dist/cjs/global-account/react/hooks/index.js +3 -1
- package/dist/cjs/global-account/react/hooks/useAccountAssets.js +5 -2
- package/dist/cjs/global-account/react/hooks/useAuthentication.js +1 -1
- package/dist/cjs/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
- package/dist/cjs/global-account/react/hooks/useGlobalAccount.js +32 -0
- package/dist/cjs/global-account/react/hooks/useQueryB3.js +5 -2
- package/dist/cjs/global-account/react/hooks/useQueryBSMNT.js +5 -2
- package/dist/cjs/global-account/react/hooks/useTokenBalancesByChain.js +7 -1
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +2 -2
- package/dist/cjs/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +1 -2
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +1 -1
- package/dist/cjs/shared/utils/fetchBalances.d.ts +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.d.ts +1 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +18 -2
- package/dist/esm/anyspend/react/components/AnySpendBondKit.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +0 -1
- package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +43 -14
- package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
- package/dist/esm/anyspend/react/components/AnySpendStakeB3.js +0 -1
- package/dist/esm/anyspend/react/components/AnyspendSignatureMint.js +1 -2
- package/dist/esm/anyspend/react/components/common/CryptoPaySection.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoReceiveSection.js +2 -1
- package/dist/esm/anyspend/react/components/common/PanelOnramp.js +4 -1
- package/dist/esm/anyspend/react/components/common/PointsBadge.d.ts +7 -0
- package/dist/esm/anyspend/react/components/common/PointsBadge.js +4 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendFlow.js +5 -3
- package/dist/esm/anyspend/services/anyspend.d.ts +1 -1
- package/dist/esm/anyspend/services/anyspend.js +2 -0
- package/dist/esm/anyspend/types/api.d.ts +41 -1
- package/dist/esm/anyspend/utils/orderPayload.js +3 -0
- package/dist/esm/bondkit/components/TradingView.js +3 -4
- package/dist/esm/bondkit/swapService.js +5 -2
- package/dist/esm/global-account/react/components/B3Provider/B3Provider.js +19 -13
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -0
- package/dist/esm/global-account/react/hooks/index.js +1 -0
- package/dist/esm/global-account/react/hooks/useAccountAssets.js +2 -2
- package/dist/esm/global-account/react/hooks/useAuthentication.js +1 -1
- package/dist/esm/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
- package/dist/esm/global-account/react/hooks/useGlobalAccount.js +29 -0
- package/dist/esm/global-account/react/hooks/useQueryB3.js +5 -2
- package/dist/esm/global-account/react/hooks/useQueryBSMNT.js +5 -2
- package/dist/esm/global-account/react/hooks/useTokenBalancesByChain.js +4 -1
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +2 -2
- package/dist/esm/global-account/react/hooks/useUnifiedChainSwitchAndExecute.js +2 -3
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +1 -1
- package/dist/esm/shared/utils/fetchBalances.d.ts +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/AnySpend.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +1 -0
- package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +2 -1
- package/dist/types/anyspend/react/components/common/PointsBadge.d.ts +7 -0
- package/dist/types/anyspend/services/anyspend.d.ts +1 -1
- package/dist/types/anyspend/types/api.d.ts +41 -1
- package/dist/types/global-account/react/hooks/index.d.ts +1 -0
- package/dist/types/global-account/react/hooks/useGlobalAccount.d.ts +6 -0
- package/dist/types/global-account/react/stores/useModalStore.d.ts +1 -1
- package/dist/types/shared/utils/fetchBalances.d.ts +1 -1
- package/package.json +22 -23
- package/src/anyspend/react/components/AnySpend.tsx +23 -1
- package/src/anyspend/react/components/AnySpendBondKit.tsx +0 -1
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +0 -1
- package/src/anyspend/react/components/AnySpendCustom.tsx +74 -15
- package/src/anyspend/react/components/AnySpendNFT.tsx +3 -0
- package/src/anyspend/react/components/AnySpendStakeB3.tsx +0 -1
- package/src/anyspend/react/components/AnyspendSignatureMint.tsx +1 -2
- package/src/anyspend/react/components/common/CryptoPaySection.tsx +1 -1
- package/src/anyspend/react/components/common/CryptoReceiveSection.tsx +6 -8
- package/src/anyspend/react/components/common/PanelOnramp.tsx +10 -10
- package/src/anyspend/react/components/common/PointsBadge.tsx +20 -0
- package/src/anyspend/react/hooks/useAnyspendFlow.ts +5 -3
- package/src/anyspend/react/hooks/useAnyspendOrderAndTransactions.ts +1 -1
- package/src/anyspend/react/hooks/useCoinbaseOnrampOptions.ts +1 -1
- package/src/anyspend/services/anyspend.ts +3 -1
- package/src/anyspend/types/api.ts +41 -1
- package/src/anyspend/utils/orderPayload.ts +3 -0
- package/src/bondkit/components/TradingView.tsx +3 -5
- package/src/bondkit/swapService.ts +10 -7
- package/src/global-account/react/components/B3Provider/B3Provider.tsx +21 -17
- package/src/global-account/react/hooks/index.ts +1 -0
- package/src/global-account/react/hooks/useAccountAssets.ts +4 -3
- package/src/global-account/react/hooks/useAuthentication.ts +1 -1
- package/src/global-account/react/hooks/useGlobalAccount.tsx +36 -0
- package/src/global-account/react/hooks/useOneBalance.tsx +1 -1
- package/src/global-account/react/hooks/useQueryB3.ts +22 -15
- package/src/global-account/react/hooks/useQueryBSMNT.ts +22 -15
- package/src/global-account/react/hooks/useTokenBalancesByChain.tsx +4 -1
- package/src/global-account/react/hooks/useTokenFromUrl.tsx +2 -2
- package/src/global-account/react/hooks/useUnifiedChainSwitchAndExecute.ts +2 -3
- package/src/global-account/react/stores/useModalStore.ts +1 -1
- package/src/shared/utils/fetchBalances.ts +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { components } from "@b3dotfun/sdk/anyspend/types/api";
|
|
2
|
-
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, }: {
|
|
2
|
+
export declare function AnySpendNFT({ loadOrder, mode, recipientAddress, nftContract, onSuccess, onShowPointsDetail, }: {
|
|
3
3
|
loadOrder?: string;
|
|
4
4
|
mode?: "modal" | "page";
|
|
5
5
|
recipientAddress?: string;
|
|
6
6
|
nftContract: components["schemas"]["NftContract"];
|
|
7
7
|
onSuccess?: (txHash?: string) => void;
|
|
8
|
+
onShowPointsDetail?: () => void;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -28,7 +28,7 @@ export declare const anyspendService: {
|
|
|
28
28
|
}>;
|
|
29
29
|
getOrderAndTransactions: (orderId: string | undefined) => Promise<GetOrderAndTxsResponse>;
|
|
30
30
|
getOrderHistory: (creatorAddress: string | undefined, limit?: number, offset?: number) => Promise<GetOrderHistoryResponse>;
|
|
31
|
-
getCoinbaseOnrampOptions: (country: string, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
|
|
31
|
+
getCoinbaseOnrampOptions: (country: string | undefined, visitorData?: VisitorData) => Promise<GetCoinbaseOnrampOptionsResponse>;
|
|
32
32
|
checkStripeSupport: (usdAmount?: string, visitorData?: VisitorData) => Promise<{
|
|
33
33
|
stripeOnramp: boolean;
|
|
34
34
|
stripeWeb2: components["schemas"]["StripeWeb2Support"];
|
|
@@ -503,11 +503,16 @@ export interface paths {
|
|
|
503
503
|
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
504
504
|
*/
|
|
505
505
|
dstTokenAddress: string;
|
|
506
|
+
/**
|
|
507
|
+
* @description Recipient address
|
|
508
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
509
|
+
*/
|
|
510
|
+
recipientAddress?: string;
|
|
506
511
|
/**
|
|
507
512
|
* @description Type of trade execution
|
|
508
513
|
* @enum {string}
|
|
509
514
|
*/
|
|
510
|
-
tradeType: "EXACT_INPUT" | "
|
|
515
|
+
tradeType: "EXACT_INPUT" | "EXACT_OUTPUT";
|
|
511
516
|
/**
|
|
512
517
|
* @description Amount to quote
|
|
513
518
|
* @example 1000000000000000000
|
|
@@ -544,6 +549,11 @@ export interface paths {
|
|
|
544
549
|
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
545
550
|
*/
|
|
546
551
|
dstTokenAddress: string;
|
|
552
|
+
/**
|
|
553
|
+
* @description Recipient address
|
|
554
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
555
|
+
*/
|
|
556
|
+
recipientAddress?: string;
|
|
547
557
|
/** @description Custom payload for execution */
|
|
548
558
|
payload: {
|
|
549
559
|
/** @description Encoded transaction data */
|
|
@@ -567,6 +577,11 @@ export interface paths {
|
|
|
567
577
|
dstChain: number;
|
|
568
578
|
srcTokenAddress: string;
|
|
569
579
|
dstTokenAddress: string;
|
|
580
|
+
/**
|
|
581
|
+
* @description Recipient address
|
|
582
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
583
|
+
*/
|
|
584
|
+
recipientAddress?: string;
|
|
570
585
|
/** @enum {string} */
|
|
571
586
|
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
572
587
|
contractAddress: string;
|
|
@@ -581,6 +596,11 @@ export interface paths {
|
|
|
581
596
|
dstChain: number;
|
|
582
597
|
srcTokenAddress: string;
|
|
583
598
|
dstTokenAddress: string;
|
|
599
|
+
/**
|
|
600
|
+
* @description Recipient address
|
|
601
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
602
|
+
*/
|
|
603
|
+
recipientAddress?: string;
|
|
584
604
|
/** @enum {string} */
|
|
585
605
|
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
586
606
|
contractAddress: string;
|
|
@@ -592,6 +612,11 @@ export interface paths {
|
|
|
592
612
|
dstChain: number;
|
|
593
613
|
srcTokenAddress: string;
|
|
594
614
|
dstTokenAddress: string;
|
|
615
|
+
/**
|
|
616
|
+
* @description Recipient address
|
|
617
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
618
|
+
*/
|
|
619
|
+
recipientAddress?: string;
|
|
595
620
|
/** @enum {string} */
|
|
596
621
|
onrampVendor?: "coinbase" | "stripe" | "stripe-web2";
|
|
597
622
|
contractAddress: string;
|
|
@@ -622,6 +647,11 @@ export interface paths {
|
|
|
622
647
|
* @example 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
623
648
|
*/
|
|
624
649
|
dstTokenAddress: string;
|
|
650
|
+
/**
|
|
651
|
+
* @description Recipient address
|
|
652
|
+
* @example 0x55c71fca5e01cf246718748ae540473e608d0282
|
|
653
|
+
*/
|
|
654
|
+
recipientAddress?: string;
|
|
625
655
|
/**
|
|
626
656
|
* @description Amount to quote
|
|
627
657
|
* @example 1000000000000000000
|
|
@@ -1087,6 +1117,11 @@ export interface components {
|
|
|
1087
1117
|
* @example 990000
|
|
1088
1118
|
*/
|
|
1089
1119
|
actualDstAmount: string | null;
|
|
1120
|
+
/**
|
|
1121
|
+
* @description Amount in after fee
|
|
1122
|
+
* @example 990000
|
|
1123
|
+
*/
|
|
1124
|
+
amountInAfterFee: string | null;
|
|
1090
1125
|
};
|
|
1091
1126
|
/** @description HypeDuel-specific payload */
|
|
1092
1127
|
HypeDuelPayload: {
|
|
@@ -1100,6 +1135,11 @@ export interface components {
|
|
|
1100
1135
|
* @example 990000
|
|
1101
1136
|
*/
|
|
1102
1137
|
actualDstAmount: string | null;
|
|
1138
|
+
/**
|
|
1139
|
+
* @description Amount in after fee
|
|
1140
|
+
* @example 990000
|
|
1141
|
+
*/
|
|
1142
|
+
amountInAfterFee: string | null;
|
|
1103
1143
|
};
|
|
1104
1144
|
/** @description Custom execution payload */
|
|
1105
1145
|
CustomPayload: {
|
|
@@ -14,6 +14,7 @@ export { useExchangeRate } from "./useExchangeRate";
|
|
|
14
14
|
export { useFirstEOA } from "./useFirstEOA";
|
|
15
15
|
export { useGetAllTWSigners, type TWSignerWithMetadata } from "./useGetAllTWSigners";
|
|
16
16
|
export { useGetGeo } from "./useGetGeo";
|
|
17
|
+
export { useGlobalAccount } from "./useGlobalAccount";
|
|
17
18
|
export { useHandleConnectWithPrivy } from "./useHandleConnectWithPrivy";
|
|
18
19
|
export { useHasMounted } from "./useHasMounted";
|
|
19
20
|
export { useIsMobile } from "./useIsMobile";
|
|
@@ -117,7 +117,7 @@ export interface AnySpendModalProps extends BaseModalProps {
|
|
|
117
117
|
/** Whether to hide the transaction history button */
|
|
118
118
|
hideTransactionHistoryButton?: boolean;
|
|
119
119
|
/** Callback function called when the transaction is successful */
|
|
120
|
-
onSuccess?: () => void;
|
|
120
|
+
onSuccess?: (txHash?: string) => void;
|
|
121
121
|
/** Token address of the destination token to buy (enables buy mode) */
|
|
122
122
|
destinationTokenAddress?: string;
|
|
123
123
|
/** Chain ID where the destination token exists (enables buy mode) */
|
|
@@ -13,4 +13,4 @@ export interface AssetBalance {
|
|
|
13
13
|
totalBalance: string;
|
|
14
14
|
chainBalances: ChainBalance[];
|
|
15
15
|
}
|
|
16
|
-
export declare const fetchBalances: (address: string, testnet?: boolean) => Promise<AssetBalance[]>;
|
|
16
|
+
export declare const fetchBalances: (address: string | undefined, testnet?: boolean) => Promise<AssetBalance[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42-alpha.1",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -236,27 +236,6 @@
|
|
|
236
236
|
"utils",
|
|
237
237
|
"constants"
|
|
238
238
|
],
|
|
239
|
-
"scripts": {
|
|
240
|
-
"clean": "rm -rf dist",
|
|
241
|
-
"prebuild": "pnpm clean",
|
|
242
|
-
"fix-dist": "[ -d ./dist/react/src ] && cp -r ./dist/react/src/* ./dist/ && rm -rf ./dist/react || echo \"No react directory found\"",
|
|
243
|
-
"build": "pnpm clean && pnpm lint && pnpm build:types && pnpm build:cjs && pnpm build:esm && pnpm build:css",
|
|
244
|
-
"build:types": "tsc -p tsconfig.cjs.json --emitDeclarationOnly --declarationDir dist/types",
|
|
245
|
-
"build:cjs": "tsc -p tsconfig.cjs.json --outDir dist/cjs --module commonjs && tsc-alias -p tsconfig.cjs.json --outDir dist/cjs && mkdir -p dist/cjs/shared/generated && cp src/shared/generated/chain-networks.json src/shared/generated/coingecko-chains.json dist/cjs/shared/generated/ && ([ -d src/bondkit/json_abis ] && mkdir -p dist/cjs/bondkit/json_abis && cp -r src/bondkit/json_abis/* dist/cjs/bondkit/json_abis/ || echo \"No bondkit json_abis\")",
|
|
246
|
-
"build:esm": "tsc -p tsconfig.esm.json --outDir dist/esm --module esnext && tsc-alias -p tsconfig.esm.json --outDir dist/esm && mkdir -p dist/esm/shared/generated && cp src/shared/generated/chain-networks.json src/shared/generated/coingecko-chains.json dist/esm/shared/generated/ && ([ -d src/bondkit/json_abis ] && mkdir -p dist/esm/bondkit/json_abis && cp -r src/bondkit/json_abis/* dist/esm/bondkit/json_abis/ || echo \"No bondkit json_abis\") && node scripts/fix-esm-imports.js",
|
|
247
|
-
"build:css": "postcss src/styles/index.css -o dist/styles/index.css",
|
|
248
|
-
"dev:cjs": "tsc-watch -p tsconfig.cjs.json --onSuccess \"tsc-alias -p tsconfig.cjs.json --outDir dist/cjs\"",
|
|
249
|
-
"dev:esm": "tsc-watch -p tsconfig.esm.json --onSuccess \"tsc-alias -p tsconfig.esm.json --outDir dist/esm\"",
|
|
250
|
-
"dev": "concurrently \"pnpm dev:cjs\" \"pnpm dev:esm\" \"pnpm dev:css\"",
|
|
251
|
-
"dev:css": "postcss src/styles/index.css -o dist/styles/index.css --watch",
|
|
252
|
-
"prepublishOnly": "pnpm build",
|
|
253
|
-
"release:test": "pnpm version prerelease --preid test && git push --follow-tags && pnpm publish --tag test --no-git-checks",
|
|
254
|
-
"release:alpha": "pnpm version prerelease --preid alpha && git push --follow-tags && pnpm publish --tag alpha --no-git-checks",
|
|
255
|
-
"typecheck": "tsc --noEmit",
|
|
256
|
-
"generate:thirdweb": "npx @hey-api/openapi-ts --file src/thirdweb/openapi-ts.config.ts --input src/thirdweb/insight-service.json",
|
|
257
|
-
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
258
|
-
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix"
|
|
259
|
-
},
|
|
260
239
|
"dependencies": {
|
|
261
240
|
"@b3dotfun/b3-api": "0.0.50",
|
|
262
241
|
"@b3dotfun/basement-api": "0.0.11",
|
|
@@ -369,5 +348,25 @@
|
|
|
369
348
|
"three": {
|
|
370
349
|
"optional": true
|
|
371
350
|
}
|
|
351
|
+
},
|
|
352
|
+
"scripts": {
|
|
353
|
+
"clean": "rm -rf dist",
|
|
354
|
+
"prebuild": "pnpm clean",
|
|
355
|
+
"fix-dist": "[ -d ./dist/react/src ] && cp -r ./dist/react/src/* ./dist/ && rm -rf ./dist/react || echo \"No react directory found\"",
|
|
356
|
+
"build": "pnpm clean && pnpm lint && pnpm build:types && pnpm build:cjs && pnpm build:esm && pnpm build:css",
|
|
357
|
+
"build:types": "tsc -p tsconfig.cjs.json --emitDeclarationOnly --declarationDir dist/types",
|
|
358
|
+
"build:cjs": "tsc -p tsconfig.cjs.json --outDir dist/cjs --module commonjs && tsc-alias -p tsconfig.cjs.json --outDir dist/cjs && mkdir -p dist/cjs/shared/generated && cp src/shared/generated/chain-networks.json src/shared/generated/coingecko-chains.json dist/cjs/shared/generated/ && ([ -d src/bondkit/json_abis ] && mkdir -p dist/cjs/bondkit/json_abis && cp -r src/bondkit/json_abis/* dist/cjs/bondkit/json_abis/ || echo \"No bondkit json_abis\")",
|
|
359
|
+
"build:esm": "tsc -p tsconfig.esm.json --outDir dist/esm --module esnext && tsc-alias -p tsconfig.esm.json --outDir dist/esm && mkdir -p dist/esm/shared/generated && cp src/shared/generated/chain-networks.json src/shared/generated/coingecko-chains.json dist/esm/shared/generated/ && ([ -d src/bondkit/json_abis ] && mkdir -p dist/esm/bondkit/json_abis && cp -r src/bondkit/json_abis/* dist/esm/bondkit/json_abis/ || echo \"No bondkit json_abis\") && node scripts/fix-esm-imports.js",
|
|
360
|
+
"build:css": "postcss src/styles/index.css -o dist/styles/index.css",
|
|
361
|
+
"dev:cjs": "tsc-watch -p tsconfig.cjs.json --onSuccess \"tsc-alias -p tsconfig.cjs.json --outDir dist/cjs\"",
|
|
362
|
+
"dev:esm": "tsc-watch -p tsconfig.esm.json --onSuccess \"tsc-alias -p tsconfig.esm.json --outDir dist/esm\"",
|
|
363
|
+
"dev": "concurrently \"pnpm dev:cjs\" \"pnpm dev:esm\" \"pnpm dev:css\"",
|
|
364
|
+
"dev:css": "postcss src/styles/index.css -o dist/styles/index.css --watch",
|
|
365
|
+
"release:test": "pnpm version prerelease --preid test && git push --follow-tags && pnpm publish --tag test --no-git-checks",
|
|
366
|
+
"release:alpha": "pnpm version prerelease --preid alpha && git push --follow-tags && pnpm publish --tag alpha --no-git-checks",
|
|
367
|
+
"typecheck": "tsc --noEmit",
|
|
368
|
+
"generate:thirdweb": "npx @hey-api/openapi-ts --file src/thirdweb/openapi-ts.config.ts --input src/thirdweb/insight-service.json",
|
|
369
|
+
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
370
|
+
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix"
|
|
372
371
|
}
|
|
373
|
-
}
|
|
372
|
+
}
|
|
@@ -78,6 +78,7 @@ export function AnySpend(props: {
|
|
|
78
78
|
* Useful for handling special cases like B3 token selection.
|
|
79
79
|
*/
|
|
80
80
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
81
|
+
onSuccess?: (txHash?: string) => void;
|
|
81
82
|
}) {
|
|
82
83
|
const fingerprintConfig = getFingerprintConfig();
|
|
83
84
|
|
|
@@ -97,6 +98,7 @@ function AnySpendInner({
|
|
|
97
98
|
hideTransactionHistoryButton,
|
|
98
99
|
recipientAddress: recipientAddressFromProps,
|
|
99
100
|
onTokenSelect,
|
|
101
|
+
onSuccess,
|
|
100
102
|
}: {
|
|
101
103
|
destinationTokenAddress?: string;
|
|
102
104
|
destinationTokenChainId?: number;
|
|
@@ -106,6 +108,7 @@ function AnySpendInner({
|
|
|
106
108
|
hideTransactionHistoryButton?: boolean;
|
|
107
109
|
recipientAddress?: string;
|
|
108
110
|
onTokenSelect?: (token: components["schemas"]["Token"], event: { preventDefault: () => void }) => void;
|
|
111
|
+
onSuccess?: (txHash?: string) => void;
|
|
109
112
|
}) {
|
|
110
113
|
const searchParams = useSearchParamsSSR();
|
|
111
114
|
const router = useRouter();
|
|
@@ -131,6 +134,9 @@ function AnySpendInner({
|
|
|
131
134
|
toAmount?: string;
|
|
132
135
|
} | null>(null);
|
|
133
136
|
|
|
137
|
+
// Track if onSuccess has been called for the current order
|
|
138
|
+
const onSuccessCalled = useRef(false);
|
|
139
|
+
|
|
134
140
|
const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(defaultActiveTab);
|
|
135
141
|
|
|
136
142
|
const [orderId, setOrderId] = useState<string | undefined>(loadOrder);
|
|
@@ -446,8 +452,9 @@ function AnySpendInner({
|
|
|
446
452
|
srcTokenAddress: selectedSrcToken.address,
|
|
447
453
|
dstTokenAddress: isBuyMode ? destinationTokenAddress : selectedDstToken.address,
|
|
448
454
|
type: "swap",
|
|
449
|
-
tradeType: isSrcInputDirty ? "EXACT_INPUT" : "
|
|
455
|
+
tradeType: isSrcInputDirty ? "EXACT_INPUT" : "EXACT_OUTPUT",
|
|
450
456
|
amount: activeInputAmountInWei,
|
|
457
|
+
recipientAddress,
|
|
451
458
|
}
|
|
452
459
|
: {
|
|
453
460
|
srcChain: base.id,
|
|
@@ -457,6 +464,7 @@ function AnySpendInner({
|
|
|
457
464
|
type: "swap",
|
|
458
465
|
tradeType: "EXACT_INPUT",
|
|
459
466
|
amount: srcAmountOnrampInWei,
|
|
467
|
+
recipientAddress,
|
|
460
468
|
onrampVendor: getOnrampVendor(selectedFiatPaymentMethod),
|
|
461
469
|
},
|
|
462
470
|
);
|
|
@@ -514,6 +522,20 @@ function AnySpendInner({
|
|
|
514
522
|
}
|
|
515
523
|
}, [anyspendQuote, isSrcInputDirty]);
|
|
516
524
|
|
|
525
|
+
useEffect(() => {
|
|
526
|
+
if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
|
|
527
|
+
console.log("Calling onSuccess");
|
|
528
|
+
const txHash = oat?.data?.executeTx?.txHash;
|
|
529
|
+
onSuccess?.(txHash);
|
|
530
|
+
onSuccessCalled.current = true;
|
|
531
|
+
}
|
|
532
|
+
}, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
|
|
533
|
+
|
|
534
|
+
// Reset flag when orderId changes
|
|
535
|
+
useEffect(() => {
|
|
536
|
+
onSuccessCalled.current = false;
|
|
537
|
+
}, [orderId]);
|
|
538
|
+
|
|
517
539
|
const { createOrder, isCreatingOrder } = useAnyspendCreateOrder({
|
|
518
540
|
onSuccess: data => {
|
|
519
541
|
const orderId = data.data.id;
|
|
@@ -675,7 +675,6 @@ export function AnySpendBuySpin({
|
|
|
675
675
|
spenderAddress={paymentConfig.entryModule}
|
|
676
676
|
encodedData={encodedData}
|
|
677
677
|
metadata={{
|
|
678
|
-
type: "custom",
|
|
679
678
|
action: `buy ${userSpinQuantity} spin${userSpinQuantity !== "1" ? "s" : ""}`,
|
|
680
679
|
}}
|
|
681
680
|
header={header}
|
|
@@ -42,12 +42,15 @@ import { motion } from "motion/react";
|
|
|
42
42
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
43
43
|
import { toast } from "sonner";
|
|
44
44
|
import { base } from "viem/chains";
|
|
45
|
+
import { useFeatureFlags } from "../contexts/FeatureFlagsContext";
|
|
45
46
|
import { AnySpendFingerprintWrapper, getFingerprintConfig } from "./AnySpendFingerprintWrapper";
|
|
46
47
|
import { CryptoPaymentMethod, CryptoPaymentMethodType } from "./common/CryptoPaymentMethod";
|
|
47
48
|
import { FiatPaymentMethod, FiatPaymentMethodComponent } from "./common/FiatPaymentMethod";
|
|
48
49
|
import { OrderDetails } from "./common/OrderDetails";
|
|
49
50
|
import { OrderHistory } from "./common/OrderHistory";
|
|
50
51
|
import { OrderToken } from "./common/OrderToken";
|
|
52
|
+
import { PointsBadge } from "./common/PointsBadge";
|
|
53
|
+
import { PointsDetailPanel } from "./common/PointsDetailPanel";
|
|
51
54
|
import { RecipientSelection } from "./common/RecipientSelection";
|
|
52
55
|
|
|
53
56
|
enum PanelView {
|
|
@@ -58,6 +61,7 @@ enum PanelView {
|
|
|
58
61
|
RECIPIENT_SELECTION,
|
|
59
62
|
CRYPTO_PAYMENT_METHOD,
|
|
60
63
|
FIAT_PAYMENT_METHOD,
|
|
64
|
+
POINTS_DETAIL,
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
function generateGetRelayQuoteRequest({
|
|
@@ -66,6 +70,7 @@ function generateGetRelayQuoteRequest({
|
|
|
66
70
|
srcToken,
|
|
67
71
|
dstChainId,
|
|
68
72
|
dstToken,
|
|
73
|
+
recipientAddress,
|
|
69
74
|
dstAmount,
|
|
70
75
|
contractAddress,
|
|
71
76
|
tokenId,
|
|
@@ -78,6 +83,7 @@ function generateGetRelayQuoteRequest({
|
|
|
78
83
|
srcToken: components["schemas"]["Token"];
|
|
79
84
|
dstChainId: number;
|
|
80
85
|
dstToken: components["schemas"]["Token"];
|
|
86
|
+
recipientAddress: string | undefined;
|
|
81
87
|
dstAmount: string;
|
|
82
88
|
contractAddress: string;
|
|
83
89
|
tokenId?: number | null;
|
|
@@ -94,6 +100,7 @@ function generateGetRelayQuoteRequest({
|
|
|
94
100
|
srcTokenAddress: srcToken.address,
|
|
95
101
|
dstChain: dstChainId,
|
|
96
102
|
dstTokenAddress: dstToken.address,
|
|
103
|
+
recipientAddress,
|
|
97
104
|
price: dstAmount,
|
|
98
105
|
contractAddress: contractAddress,
|
|
99
106
|
tokenId: tokenId,
|
|
@@ -107,6 +114,7 @@ function generateGetRelayQuoteRequest({
|
|
|
107
114
|
srcTokenAddress: srcToken.address,
|
|
108
115
|
dstChain: dstChainId,
|
|
109
116
|
dstTokenAddress: dstToken.address,
|
|
117
|
+
recipientAddress,
|
|
110
118
|
price: dstAmount,
|
|
111
119
|
contractAddress: contractAddress,
|
|
112
120
|
};
|
|
@@ -118,6 +126,7 @@ function generateGetRelayQuoteRequest({
|
|
|
118
126
|
srcTokenAddress: srcToken.address,
|
|
119
127
|
dstChain: dstChainId,
|
|
120
128
|
dstTokenAddress: dstToken.address,
|
|
129
|
+
recipientAddress,
|
|
121
130
|
fundAmount: dstAmount,
|
|
122
131
|
contractAddress: contractAddress,
|
|
123
132
|
};
|
|
@@ -129,6 +138,7 @@ function generateGetRelayQuoteRequest({
|
|
|
129
138
|
srcTokenAddress: srcToken.address,
|
|
130
139
|
dstChain: dstChainId,
|
|
131
140
|
dstTokenAddress: dstToken.address,
|
|
141
|
+
recipientAddress,
|
|
132
142
|
payload: {
|
|
133
143
|
amount: dstAmount,
|
|
134
144
|
data: encodedData,
|
|
@@ -165,6 +175,7 @@ export function AnySpendCustom(props: {
|
|
|
165
175
|
}) => React.JSX.Element;
|
|
166
176
|
onSuccess?: (txHash?: string) => void;
|
|
167
177
|
showRecipient?: boolean;
|
|
178
|
+
onShowPointsDetail?: () => void;
|
|
168
179
|
}) {
|
|
169
180
|
const fingerprintConfig = getFingerprintConfig();
|
|
170
181
|
|
|
@@ -191,6 +202,7 @@ function AnySpendCustomInner({
|
|
|
191
202
|
header,
|
|
192
203
|
onSuccess,
|
|
193
204
|
showRecipient = true,
|
|
205
|
+
onShowPointsDetail,
|
|
194
206
|
}: {
|
|
195
207
|
loadOrder?: string;
|
|
196
208
|
mode?: "modal" | "page";
|
|
@@ -213,8 +225,10 @@ function AnySpendCustomInner({
|
|
|
213
225
|
}) => React.JSX.Element;
|
|
214
226
|
onSuccess?: (txHash?: string) => void;
|
|
215
227
|
showRecipient?: boolean;
|
|
228
|
+
onShowPointsDetail?: () => void;
|
|
216
229
|
}) {
|
|
217
230
|
const hasMounted = useHasMounted();
|
|
231
|
+
const featureFlags = useFeatureFlags();
|
|
218
232
|
|
|
219
233
|
const searchParams = useSearchParamsSSR();
|
|
220
234
|
const router = useRouter();
|
|
@@ -241,6 +255,9 @@ function AnySpendCustomInner({
|
|
|
241
255
|
|
|
242
256
|
const [orderId, setOrderId] = useState<string | undefined>(loadOrder);
|
|
243
257
|
|
|
258
|
+
// Track if onSuccess has been called for the current order
|
|
259
|
+
const onSuccessCalled = React.useRef(false);
|
|
260
|
+
|
|
244
261
|
const [srcChainId, setSrcChainId] = useState<number>(base.id);
|
|
245
262
|
|
|
246
263
|
// Get token list for token balance check
|
|
@@ -312,10 +329,11 @@ function AnySpendCustomInner({
|
|
|
312
329
|
srcToken: activeTab === "fiat" ? USDC_BASE : srcToken,
|
|
313
330
|
dstChainId: dstChainId,
|
|
314
331
|
dstToken: dstToken,
|
|
332
|
+
recipientAddress,
|
|
315
333
|
dstAmount: dstAmount,
|
|
316
334
|
contractAddress: contractAddress,
|
|
317
|
-
tokenId:
|
|
318
|
-
contractType:
|
|
335
|
+
tokenId: orderType === "mint_nft" ? metadata?.nftContract?.tokenId : undefined,
|
|
336
|
+
contractType: orderType === "mint_nft" ? metadata?.nftContract?.type : undefined,
|
|
319
337
|
encodedData: encodedData,
|
|
320
338
|
spenderAddress: spenderAddress,
|
|
321
339
|
});
|
|
@@ -328,8 +346,8 @@ function AnySpendCustomInner({
|
|
|
328
346
|
encodedData,
|
|
329
347
|
metadata?.nftContract?.tokenId,
|
|
330
348
|
metadata?.nftContract?.type,
|
|
331
|
-
metadata?.type,
|
|
332
349
|
orderType,
|
|
350
|
+
recipientAddress,
|
|
333
351
|
spenderAddress,
|
|
334
352
|
srcChainId,
|
|
335
353
|
srcToken,
|
|
@@ -375,12 +393,18 @@ function AnySpendCustomInner({
|
|
|
375
393
|
useGeoOnrampOptions(srcFiatAmount);
|
|
376
394
|
|
|
377
395
|
useEffect(() => {
|
|
378
|
-
if (oat?.data?.order.status === "executed") {
|
|
396
|
+
if (oat?.data?.order.status === "executed" && !onSuccessCalled.current) {
|
|
379
397
|
console.log("Calling onSuccess");
|
|
380
398
|
const txHash = oat?.data?.executeTx?.txHash;
|
|
381
399
|
onSuccess?.(txHash);
|
|
400
|
+
onSuccessCalled.current = true;
|
|
382
401
|
}
|
|
383
|
-
}, [oat?.data?.
|
|
402
|
+
}, [oat?.data?.order.status, oat?.data?.executeTx?.txHash, onSuccess]);
|
|
403
|
+
|
|
404
|
+
// Reset flag when orderId changes
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
onSuccessCalled.current = false;
|
|
407
|
+
}, [orderId]);
|
|
384
408
|
|
|
385
409
|
const { createOrder: createRegularOrder, isCreatingOrder: isCreatingRegularOrder } = useAnyspendCreateOrder({
|
|
386
410
|
onSuccess: data => {
|
|
@@ -426,7 +450,7 @@ function AnySpendCustomInner({
|
|
|
426
450
|
recipientAddress,
|
|
427
451
|
creatorAddress: currentWallet?.wallet?.address,
|
|
428
452
|
nft:
|
|
429
|
-
|
|
453
|
+
orderType === "mint_nft"
|
|
430
454
|
? metadata.nftContract.type === "erc1155"
|
|
431
455
|
? {
|
|
432
456
|
type: "erc1155",
|
|
@@ -448,7 +472,7 @@ function AnySpendCustomInner({
|
|
|
448
472
|
}
|
|
449
473
|
: undefined,
|
|
450
474
|
tournament:
|
|
451
|
-
|
|
475
|
+
orderType === "join_tournament" || orderType === "fund_tournament"
|
|
452
476
|
? {
|
|
453
477
|
...metadata.tournament,
|
|
454
478
|
contractAddress: contractAddress,
|
|
@@ -457,13 +481,12 @@ function AnySpendCustomInner({
|
|
|
457
481
|
: undefined,
|
|
458
482
|
// only populate payload for custom tx
|
|
459
483
|
payload:
|
|
460
|
-
|
|
484
|
+
orderType === "custom"
|
|
461
485
|
? {
|
|
462
486
|
amount: dstAmount,
|
|
463
487
|
data: encodedData,
|
|
464
488
|
spenderAddress: spenderAddress,
|
|
465
489
|
to: contractAddress,
|
|
466
|
-
action: metadata.action,
|
|
467
490
|
}
|
|
468
491
|
: undefined,
|
|
469
492
|
} as CreateOrderParams;
|
|
@@ -749,6 +772,23 @@ function AnySpendCustomInner({
|
|
|
749
772
|
</div>
|
|
750
773
|
);
|
|
751
774
|
|
|
775
|
+
// Render points badge if conditions are met
|
|
776
|
+
const renderPointsBadge = () => {
|
|
777
|
+
if (featureFlags.showPoints && anyspendQuote?.data?.pointsAmount && anyspendQuote.data.pointsAmount > 0) {
|
|
778
|
+
return (
|
|
779
|
+
<PointsBadge
|
|
780
|
+
pointsAmount={anyspendQuote.data.pointsAmount}
|
|
781
|
+
pointsMultiplier={anyspendQuote.data.pointsMultiplier}
|
|
782
|
+
onClick={() => {
|
|
783
|
+
onShowPointsDetail?.();
|
|
784
|
+
setActivePanel(PanelView.POINTS_DETAIL);
|
|
785
|
+
}}
|
|
786
|
+
/>
|
|
787
|
+
);
|
|
788
|
+
}
|
|
789
|
+
return null;
|
|
790
|
+
};
|
|
791
|
+
|
|
752
792
|
// Confirm order view.
|
|
753
793
|
const confirmOrderView = (
|
|
754
794
|
<div className={"relative mx-auto flex w-full flex-col items-center"}>
|
|
@@ -917,9 +957,12 @@ function AnySpendCustomInner({
|
|
|
917
957
|
transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
|
|
918
958
|
className="relative flex w-full items-center justify-between"
|
|
919
959
|
>
|
|
920
|
-
<
|
|
921
|
-
|
|
922
|
-
|
|
960
|
+
<div className="flex items-center gap-2">
|
|
961
|
+
<span className="text-as-tertiarry text-sm">
|
|
962
|
+
Total <span className="text-as-tertiarry">(with fee)</span>
|
|
963
|
+
</span>
|
|
964
|
+
{renderPointsBadge()}
|
|
965
|
+
</div>
|
|
923
966
|
<span className="text-as-primary font-semibold">
|
|
924
967
|
{formattedSrcAmount || "--"} {srcToken.symbol}
|
|
925
968
|
</span>
|
|
@@ -1040,9 +1083,12 @@ function AnySpendCustomInner({
|
|
|
1040
1083
|
transition={{ duration: 0.3, delay: 0.1, ease: "easeInOut" }}
|
|
1041
1084
|
className="relative flex w-full items-center justify-between"
|
|
1042
1085
|
>
|
|
1043
|
-
<
|
|
1044
|
-
|
|
1045
|
-
|
|
1086
|
+
<div className="flex items-center gap-2">
|
|
1087
|
+
<span className="text-as-tertiarry text-sm">
|
|
1088
|
+
Total <span className="text-as-tertiarry">(USD)</span>
|
|
1089
|
+
</span>
|
|
1090
|
+
{renderPointsBadge()}
|
|
1091
|
+
</div>
|
|
1046
1092
|
<span className="text-as-primary text-xl font-semibold">${srcFiatAmount || "0.00"}</span>
|
|
1047
1093
|
</motion.div>
|
|
1048
1094
|
</div>
|
|
@@ -1153,6 +1199,16 @@ function AnySpendCustomInner({
|
|
|
1153
1199
|
</div>
|
|
1154
1200
|
);
|
|
1155
1201
|
|
|
1202
|
+
// Points detail view
|
|
1203
|
+
const pointsDetailView = (
|
|
1204
|
+
<div className={cn("bg-as-surface-primary mx-auto w-[460px] max-w-full rounded-xl p-4")}>
|
|
1205
|
+
<PointsDetailPanel
|
|
1206
|
+
pointsAmount={anyspendQuote?.data?.pointsAmount || 0}
|
|
1207
|
+
onBack={() => setActivePanel(PanelView.CONFIRM_ORDER)}
|
|
1208
|
+
/>
|
|
1209
|
+
</div>
|
|
1210
|
+
);
|
|
1211
|
+
|
|
1156
1212
|
// Return the TransitionPanel with all views
|
|
1157
1213
|
return (
|
|
1158
1214
|
<StyleRoot>
|
|
@@ -1196,6 +1252,9 @@ function AnySpendCustomInner({
|
|
|
1196
1252
|
<div key="fiat-payment-method-view" className="w-full">
|
|
1197
1253
|
{fiatPaymentMethodView}
|
|
1198
1254
|
</div>,
|
|
1255
|
+
<div key="points-detail-view" className="w-full">
|
|
1256
|
+
{pointsDetailView}
|
|
1257
|
+
</div>,
|
|
1199
1258
|
]}
|
|
1200
1259
|
</TransitionPanel>
|
|
1201
1260
|
</StyleRoot>
|
|
@@ -36,12 +36,14 @@ export function AnySpendNFT({
|
|
|
36
36
|
recipientAddress,
|
|
37
37
|
nftContract,
|
|
38
38
|
onSuccess,
|
|
39
|
+
onShowPointsDetail,
|
|
39
40
|
}: {
|
|
40
41
|
loadOrder?: string;
|
|
41
42
|
mode?: "modal" | "page";
|
|
42
43
|
recipientAddress?: string;
|
|
43
44
|
nftContract: components["schemas"]["NftContract"];
|
|
44
45
|
onSuccess?: (txHash?: string) => void;
|
|
46
|
+
onShowPointsDetail?: () => void;
|
|
45
47
|
}) {
|
|
46
48
|
const [imageUrlWithFallback, setFallbackImageUrl] = useState<string | null>(nftContract.imageUrl);
|
|
47
49
|
const [isLoadingFallback, setIsLoadingFallback] = useState(false);
|
|
@@ -164,6 +166,7 @@ export function AnySpendNFT({
|
|
|
164
166
|
}}
|
|
165
167
|
header={header}
|
|
166
168
|
onSuccess={onSuccess}
|
|
169
|
+
onShowPointsDetail={onShowPointsDetail}
|
|
167
170
|
/>
|
|
168
171
|
);
|
|
169
172
|
}
|
|
@@ -141,10 +141,9 @@ export function AnyspendSignatureMint({
|
|
|
141
141
|
dstChainId={signatureData.collection.chainId}
|
|
142
142
|
dstToken={dstToken}
|
|
143
143
|
dstAmount={price.toString()}
|
|
144
|
-
contractAddress={signatureData.collection.address
|
|
144
|
+
contractAddress={signatureData.collection.address || ""}
|
|
145
145
|
encodedData={encodedData}
|
|
146
146
|
metadata={{
|
|
147
|
-
type: "custom",
|
|
148
147
|
action: "Signature Mint",
|
|
149
148
|
}}
|
|
150
149
|
header={header}
|
|
@@ -48,7 +48,7 @@ export function CryptoPaySection({
|
|
|
48
48
|
const walletAddress =
|
|
49
49
|
selectedCryptoPaymentMethod === CryptoPaymentMethodType.GLOBAL_WALLET
|
|
50
50
|
? connectedSmartWallet?.getAccount()?.address
|
|
51
|
-
: connectedEOAWallet?.getAccount()?.address
|
|
51
|
+
: connectedEOAWallet?.getAccount()?.address;
|
|
52
52
|
|
|
53
53
|
const { data: profileData } = useProfile({ address: walletAddress });
|
|
54
54
|
const connectedName = profileData?.displayName;
|