@b3dotfun/sdk 0.0.5-alpha.0 → 0.0.5-alpha.2
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.js +2 -2
- package/dist/cjs/anyspend/react/components/index.d.ts +1 -0
- package/dist/cjs/anyspend/react/components/index.js +3 -1
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +37 -0
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
- package/dist/cjs/anyspend/react/components/webview/WebviewOnrampPayment.js +141 -61
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
- package/dist/cjs/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +4 -3
- package/dist/cjs/anyspend/services/anyspend.d.ts +2 -1
- package/dist/cjs/anyspend/services/anyspend.js +3 -2
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.d.ts +4 -0
- package/dist/cjs/global-account/react/hooks/useTokenFromUrl.js +23 -0
- package/dist/esm/anyspend/react/components/AnySpend.js +2 -2
- package/dist/esm/anyspend/react/components/index.d.ts +1 -0
- package/dist/esm/anyspend/react/components/index.js +1 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampOrderStatus.js +31 -0
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
- package/dist/esm/anyspend/react/components/webview/WebviewOnrampPayment.js +139 -59
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
- package/dist/esm/anyspend/react/hooks/useAnyspendCreateOnrampOrder.js +5 -4
- package/dist/esm/anyspend/services/anyspend.d.ts +2 -1
- package/dist/esm/anyspend/services/anyspend.js +3 -2
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.d.ts +4 -0
- package/dist/esm/global-account/react/hooks/useTokenFromUrl.js +22 -0
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/index.d.ts +1 -0
- package/dist/types/anyspend/react/components/webview/WebviewOnrampOrderStatus.d.ts +6 -0
- package/dist/types/anyspend/react/components/webview/WebviewOnrampPayment.d.ts +3 -2
- package/dist/types/anyspend/react/hooks/useAnyspendCreateOnrampOrder.d.ts +1 -0
- package/dist/types/anyspend/services/anyspend.d.ts +2 -1
- package/dist/types/global-account/react/hooks/useTokenFromUrl.d.ts +4 -0
- package/package.json +1 -1
- package/src/anyspend/README.md +694 -0
- package/src/anyspend/react/components/AnySpend.tsx +2 -2
- package/src/anyspend/react/components/index.ts +1 -0
- package/src/anyspend/react/components/webview/WebviewOnrampOrderStatus.tsx +120 -0
- package/src/anyspend/react/components/webview/WebviewOnrampPayment.tsx +294 -132
- package/src/anyspend/react/hooks/useAnyspendCreateOnrampOrder.ts +7 -4
- package/src/anyspend/services/anyspend.ts +5 -2
- package/src/global-account/react/hooks/useTokenFromUrl.tsx +25 -1
|
@@ -65,7 +65,8 @@ export const anyspendService = {
|
|
|
65
65
|
payload,
|
|
66
66
|
onramp,
|
|
67
67
|
metadata,
|
|
68
|
-
creatorAddress
|
|
68
|
+
creatorAddress,
|
|
69
|
+
partnerId
|
|
69
70
|
}: {
|
|
70
71
|
isMainnet: boolean;
|
|
71
72
|
recipientAddress: string;
|
|
@@ -79,6 +80,7 @@ export const anyspendService = {
|
|
|
79
80
|
onramp?: OnrampOptions;
|
|
80
81
|
metadata: Record<string, any>;
|
|
81
82
|
creatorAddress?: string;
|
|
83
|
+
partnerId?: string;
|
|
82
84
|
}) => {
|
|
83
85
|
const response = await fetch(`${isMainnet ? ANYSPEND_MAINNET_BASE_URL : ANYSPEND_TESTNET_BASE_URL}/orders`, {
|
|
84
86
|
method: "POST",
|
|
@@ -96,7 +98,8 @@ export const anyspendService = {
|
|
|
96
98
|
payload,
|
|
97
99
|
onramp,
|
|
98
100
|
metadata,
|
|
99
|
-
creatorAddress
|
|
101
|
+
creatorAddress,
|
|
102
|
+
partnerId
|
|
100
103
|
})
|
|
101
104
|
});
|
|
102
105
|
const data = await response.json();
|
|
@@ -16,7 +16,6 @@ interface UseTokenFromUrlOptions {
|
|
|
16
16
|
*/
|
|
17
17
|
prefix: string;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
19
|
interface TokenInfo {
|
|
21
20
|
data: {
|
|
22
21
|
attributes: {
|
|
@@ -102,3 +101,28 @@ export function useTokenFromUrl({ defaultToken, prefix }: UseTokenFromUrlOptions
|
|
|
102
101
|
}
|
|
103
102
|
};
|
|
104
103
|
}
|
|
104
|
+
|
|
105
|
+
export function useTokenFromAddress({ address, chainId }: { address: string; chainId: number }): Token | undefined {
|
|
106
|
+
const { data: tokenInfo, isError } = useQuery({
|
|
107
|
+
queryKey: ["tokenInfo", address, chainId],
|
|
108
|
+
queryFn: () => fetchTokenInfo(getCoingeckoChainInfo(chainId).coingecko_id, address),
|
|
109
|
+
enabled: Boolean(address),
|
|
110
|
+
staleTime: Infinity,
|
|
111
|
+
gcTime: Infinity
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (isError || !tokenInfo) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
address,
|
|
120
|
+
chainId,
|
|
121
|
+
name: tokenInfo?.data.attributes.name || "",
|
|
122
|
+
symbol: tokenInfo?.data.attributes.symbol || "",
|
|
123
|
+
decimals: tokenInfo?.data.attributes.decimals || 18,
|
|
124
|
+
metadata: {
|
|
125
|
+
logoURI: tokenInfo?.data.attributes.image_url
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|