@b3dotfun/sdk 0.0.1-alpha.5 → 0.0.1-alpha.7
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/index.native.d.ts +13 -0
- package/dist/cjs/anyspend/index.native.js +35 -0
- package/dist/cjs/anyspend/react/components/AnySpendBuySpin.js +3 -1
- package/dist/cjs/anyspend/utils/chain.js +3 -0
- package/dist/cjs/global-account/react/index.native.d.ts +3 -0
- package/dist/cjs/global-account/react/index.native.js +19 -0
- package/dist/cjs/shared/utils/chains.js +4 -0
- package/dist/esm/anyspend/index.native.d.ts +13 -0
- package/dist/esm/anyspend/index.native.js +19 -0
- package/dist/esm/anyspend/react/components/AnySpendBuySpin.js +3 -1
- package/dist/esm/anyspend/utils/chain.js +3 -0
- package/dist/esm/global-account/react/index.native.d.ts +3 -0
- package/dist/esm/global-account/react/index.native.js +3 -0
- package/dist/esm/shared/utils/chains.js +4 -0
- package/dist/types/anyspend/index.native.d.ts +13 -0
- package/dist/types/global-account/react/index.native.d.ts +3 -0
- package/package.json +1 -2
- package/src/anyspend/index.native.ts +24 -0
- package/src/anyspend/react/components/AnySpendBuySpin.tsx +5 -1
- package/src/anyspend/utils/chain.ts +3 -0
- package/src/global-account/react/index.native.ts +3 -0
- package/src/shared/utils/chains.ts +4 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./react/hooks";
|
|
2
|
+
export * from "./react/providers/AnyspendProvider";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export * from "./utils/address";
|
|
5
|
+
export * from "./utils/chain";
|
|
6
|
+
export * from "./utils/format";
|
|
7
|
+
export * from "./utils/json";
|
|
8
|
+
export * from "./utils/number";
|
|
9
|
+
export * from "./utils/string";
|
|
10
|
+
export * from "./utils/token";
|
|
11
|
+
export * from "./constants";
|
|
12
|
+
export * from "./abis/abi-usdc-base";
|
|
13
|
+
export * from "./abis/erc20-staking";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Export all hooks
|
|
18
|
+
__exportStar(require("./react/hooks"), exports);
|
|
19
|
+
// Providers
|
|
20
|
+
__exportStar(require("./react/providers/AnyspendProvider"), exports);
|
|
21
|
+
// Types
|
|
22
|
+
__exportStar(require("./types"), exports);
|
|
23
|
+
// Utils
|
|
24
|
+
__exportStar(require("./utils/address"), exports);
|
|
25
|
+
__exportStar(require("./utils/chain"), exports);
|
|
26
|
+
__exportStar(require("./utils/format"), exports);
|
|
27
|
+
__exportStar(require("./utils/json"), exports);
|
|
28
|
+
__exportStar(require("./utils/number"), exports);
|
|
29
|
+
__exportStar(require("./utils/string"), exports);
|
|
30
|
+
__exportStar(require("./utils/token"), exports);
|
|
31
|
+
// Constants
|
|
32
|
+
__exportStar(require("./constants"), exports);
|
|
33
|
+
// Abis
|
|
34
|
+
__exportStar(require("./abis/abi-usdc-base"), exports);
|
|
35
|
+
__exportStar(require("./abis/erc20-staking"), exports);
|
|
@@ -184,7 +184,9 @@ function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", spinwhee
|
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
// Check maximum entries per user (0 means no limit)
|
|
187
|
-
if (paymentConfig &&
|
|
187
|
+
if (paymentConfig &&
|
|
188
|
+
paymentConfig.maxEntriesPerUser > BigInt(0) &&
|
|
189
|
+
BigInt(numValue) > paymentConfig.maxEntriesPerUser) {
|
|
188
190
|
setIsQuantityValid(false);
|
|
189
191
|
setUserSpinQuantity("");
|
|
190
192
|
setValidationError(`Maximum ${paymentConfig.maxEntriesPerUser.toString()} spins allowed`);
|
|
@@ -267,6 +267,9 @@ function getPaymentUrl(address, amount, currency) {
|
|
|
267
267
|
return `ethereum:${address}`;
|
|
268
268
|
}
|
|
269
269
|
function getExplorerTxUrl(chainId, txHash) {
|
|
270
|
+
if (chainId === chains_1.b3.id) {
|
|
271
|
+
return "https://explorer.b3.fun/b3/tx/" + txHash;
|
|
272
|
+
}
|
|
270
273
|
if (exports.EVM_CHAINS[chainId]) {
|
|
271
274
|
return exports.EVM_CHAINS[chainId].viem.blockExplorers?.default.url + "/tx/" + txHash;
|
|
272
275
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components"), exports);
|
|
18
|
+
__exportStar(require("./hooks"), exports);
|
|
19
|
+
__exportStar(require("./stores"), exports);
|
|
@@ -6,6 +6,7 @@ exports.getExplorerUrl = getExplorerUrl;
|
|
|
6
6
|
exports.getAddressExplorerUrl = getAddressExplorerUrl;
|
|
7
7
|
exports.getTokenExplorerUrl = getTokenExplorerUrl;
|
|
8
8
|
const supported_1 = require("../../shared/constants/chains/supported");
|
|
9
|
+
const chains_1 = require("viem/chains");
|
|
9
10
|
const baseChainBaseUrl = "https://basescan.org";
|
|
10
11
|
function getChainById(id) {
|
|
11
12
|
return Object.values(supported_1.supportedChains).find(chain => chain.id === id);
|
|
@@ -15,6 +16,9 @@ function chainIdToName(id) {
|
|
|
15
16
|
return name === "Base Mainnet" ? "Base" : name === "The Open Network" ? "Open Network" : name;
|
|
16
17
|
}
|
|
17
18
|
function getExplorerUrl(chain, txHash) {
|
|
19
|
+
if (chain.id === chains_1.b3.id) {
|
|
20
|
+
return "https://explorer.b3.fun/b3/tx/" + txHash;
|
|
21
|
+
}
|
|
18
22
|
let baseUrl = chain.blockExplorers?.default.url;
|
|
19
23
|
if (chain.id === 8453) {
|
|
20
24
|
baseUrl = baseChainBaseUrl;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./react/hooks";
|
|
2
|
+
export * from "./react/providers/AnyspendProvider";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export * from "./utils/address";
|
|
5
|
+
export * from "./utils/chain";
|
|
6
|
+
export * from "./utils/format";
|
|
7
|
+
export * from "./utils/json";
|
|
8
|
+
export * from "./utils/number";
|
|
9
|
+
export * from "./utils/string";
|
|
10
|
+
export * from "./utils/token";
|
|
11
|
+
export * from "./constants";
|
|
12
|
+
export * from "./abis/abi-usdc-base";
|
|
13
|
+
export * from "./abis/erc20-staking";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Export all hooks
|
|
2
|
+
export * from "./react/hooks";
|
|
3
|
+
// Providers
|
|
4
|
+
export * from "./react/providers/AnyspendProvider";
|
|
5
|
+
// Types
|
|
6
|
+
export * from "./types";
|
|
7
|
+
// Utils
|
|
8
|
+
export * from "./utils/address";
|
|
9
|
+
export * from "./utils/chain";
|
|
10
|
+
export * from "./utils/format";
|
|
11
|
+
export * from "./utils/json";
|
|
12
|
+
export * from "./utils/number";
|
|
13
|
+
export * from "./utils/string";
|
|
14
|
+
export * from "./utils/token";
|
|
15
|
+
// Constants
|
|
16
|
+
export * from "./constants";
|
|
17
|
+
// Abis
|
|
18
|
+
export * from "./abis/abi-usdc-base";
|
|
19
|
+
export * from "./abis/erc20-staking";
|
|
@@ -178,7 +178,9 @@ export function AnySpendBuySpin({ isMainnet = true, loadOrder, mode = "modal", s
|
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
180
|
// Check maximum entries per user (0 means no limit)
|
|
181
|
-
if (paymentConfig &&
|
|
181
|
+
if (paymentConfig &&
|
|
182
|
+
paymentConfig.maxEntriesPerUser > BigInt(0) &&
|
|
183
|
+
BigInt(numValue) > paymentConfig.maxEntriesPerUser) {
|
|
182
184
|
setIsQuantityValid(false);
|
|
183
185
|
setUserSpinQuantity("");
|
|
184
186
|
setValidationError(`Maximum ${paymentConfig.maxEntriesPerUser.toString()} spins allowed`);
|
|
@@ -244,6 +244,9 @@ export function getPaymentUrl(address, amount, currency) {
|
|
|
244
244
|
return `ethereum:${address}`;
|
|
245
245
|
}
|
|
246
246
|
export function getExplorerTxUrl(chainId, txHash) {
|
|
247
|
+
if (chainId === b3.id) {
|
|
248
|
+
return "https://explorer.b3.fun/b3/tx/" + txHash;
|
|
249
|
+
}
|
|
247
250
|
if (EVM_CHAINS[chainId]) {
|
|
248
251
|
return EVM_CHAINS[chainId].viem.blockExplorers?.default.url + "/tx/" + txHash;
|
|
249
252
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { supportedChains } from "../../shared/constants/chains/supported";
|
|
2
|
+
import { b3 } from "viem/chains";
|
|
2
3
|
const baseChainBaseUrl = "https://basescan.org";
|
|
3
4
|
export function getChainById(id) {
|
|
4
5
|
return Object.values(supportedChains).find(chain => chain.id === id);
|
|
@@ -8,6 +9,9 @@ export function chainIdToName(id) {
|
|
|
8
9
|
return name === "Base Mainnet" ? "Base" : name === "The Open Network" ? "Open Network" : name;
|
|
9
10
|
}
|
|
10
11
|
export function getExplorerUrl(chain, txHash) {
|
|
12
|
+
if (chain.id === b3.id) {
|
|
13
|
+
return "https://explorer.b3.fun/b3/tx/" + txHash;
|
|
14
|
+
}
|
|
11
15
|
let baseUrl = chain.blockExplorers?.default.url;
|
|
12
16
|
if (chain.id === 8453) {
|
|
13
17
|
baseUrl = baseChainBaseUrl;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./react/hooks";
|
|
2
|
+
export * from "./react/providers/AnyspendProvider";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export * from "./utils/address";
|
|
5
|
+
export * from "./utils/chain";
|
|
6
|
+
export * from "./utils/format";
|
|
7
|
+
export * from "./utils/json";
|
|
8
|
+
export * from "./utils/number";
|
|
9
|
+
export * from "./utils/string";
|
|
10
|
+
export * from "./utils/token";
|
|
11
|
+
export * from "./constants";
|
|
12
|
+
export * from "./abis/abi-usdc-base";
|
|
13
|
+
export * from "./abis/erc20-staking";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b3dotfun/sdk",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.7",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"react-native": "./dist/cjs/index.native.js",
|
|
@@ -255,7 +255,6 @@
|
|
|
255
255
|
}
|
|
256
256
|
},
|
|
257
257
|
"peerDependencies": {
|
|
258
|
-
"@privy-io/react-auth": "*",
|
|
259
258
|
"@react-three/postprocessing": "2.16.6",
|
|
260
259
|
"@readyplayerme/visage": "6.10.0",
|
|
261
260
|
"@tanstack/react-query": "5.55.0",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Export all hooks
|
|
2
|
+
export * from "./react/hooks";
|
|
3
|
+
|
|
4
|
+
// Providers
|
|
5
|
+
export * from "./react/providers/AnyspendProvider";
|
|
6
|
+
|
|
7
|
+
// Types
|
|
8
|
+
export * from "./types";
|
|
9
|
+
|
|
10
|
+
// Utils
|
|
11
|
+
export * from "./utils/address";
|
|
12
|
+
export * from "./utils/chain";
|
|
13
|
+
export * from "./utils/format";
|
|
14
|
+
export * from "./utils/json";
|
|
15
|
+
export * from "./utils/number";
|
|
16
|
+
export * from "./utils/string";
|
|
17
|
+
export * from "./utils/token";
|
|
18
|
+
|
|
19
|
+
// Constants
|
|
20
|
+
export * from "./constants";
|
|
21
|
+
|
|
22
|
+
// Abis
|
|
23
|
+
export * from "./abis/abi-usdc-base";
|
|
24
|
+
export * from "./abis/erc20-staking";
|
|
@@ -238,7 +238,11 @@ export function AnySpendBuySpin({
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
// Check maximum entries per user (0 means no limit)
|
|
241
|
-
if (
|
|
241
|
+
if (
|
|
242
|
+
paymentConfig &&
|
|
243
|
+
paymentConfig.maxEntriesPerUser > BigInt(0) &&
|
|
244
|
+
BigInt(numValue) > paymentConfig.maxEntriesPerUser
|
|
245
|
+
) {
|
|
242
246
|
setIsQuantityValid(false);
|
|
243
247
|
setUserSpinQuantity("");
|
|
244
248
|
setValidationError(`Maximum ${paymentConfig.maxEntriesPerUser.toString()} spins allowed`);
|
|
@@ -311,6 +311,9 @@ export function getPaymentUrl(address: string, amount: bigint, currency: string)
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
export function getExplorerTxUrl(chainId: number, txHash: string) {
|
|
314
|
+
if (chainId === b3.id) {
|
|
315
|
+
return "https://explorer.b3.fun/b3/tx/" + txHash;
|
|
316
|
+
}
|
|
314
317
|
if (EVM_CHAINS[chainId]) {
|
|
315
318
|
return EVM_CHAINS[chainId].viem.blockExplorers?.default.url + "/tx/" + txHash;
|
|
316
319
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { supportedChains } from "@b3dotfun/sdk/shared/constants/chains/supported";
|
|
2
|
-
import { Chain } from "viem/chains";
|
|
2
|
+
import { b3, Chain } from "viem/chains";
|
|
3
3
|
|
|
4
4
|
const baseChainBaseUrl = "https://basescan.org";
|
|
5
5
|
|
|
@@ -13,6 +13,9 @@ export function chainIdToName(id: number) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function getExplorerUrl(chain: Chain, txHash: string): string {
|
|
16
|
+
if (chain.id === b3.id) {
|
|
17
|
+
return "https://explorer.b3.fun/b3/tx/" + txHash;
|
|
18
|
+
}
|
|
16
19
|
let baseUrl = chain.blockExplorers?.default.url;
|
|
17
20
|
if (chain.id === 8453) {
|
|
18
21
|
baseUrl = baseChainBaseUrl;
|