@sign-global/tokentable 0.3.0 → 0.4.0-beta.10
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/.github/workflows/beta.yml +28 -0
- package/README.md +98 -2
- package/dist/cjs/airdrop/AirdropClient.d.ts +46 -0
- package/dist/cjs/airdrop/AirdropClient.js +251 -0
- package/dist/cjs/airdrop/AirdropClient.js.map +1 -0
- package/dist/cjs/airdrop/SignatureAirdropClient.d.ts +39 -0
- package/dist/cjs/airdrop/SignatureAirdropClient.js +185 -0
- package/dist/cjs/airdrop/SignatureAirdropClient.js.map +1 -0
- package/dist/cjs/airdrop/common/index.d.ts +1 -1
- package/dist/cjs/airdrop/constants/index.d.ts +4 -0
- package/dist/cjs/airdrop/constants/index.js +5 -1
- package/dist/cjs/airdrop/constants/index.js.map +1 -1
- package/dist/cjs/airdrop/core/evm/SignatureAirdropService.d.ts +23 -0
- package/dist/cjs/airdrop/core/evm/SignatureAirdropService.js +71 -0
- package/dist/cjs/airdrop/core/evm/SignatureAirdropService.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.d.ts +16 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.js +47 -0
- package/dist/cjs/airdrop/core/evm/contracts/AirdropSignatureClient.js.map +1 -0
- package/dist/cjs/airdrop/core/evm/contracts/abis/FungibleTokenECDSADistributor.json +564 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/WalletBase.d.ts +32 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/WalletBase.js +71 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/WalletBase.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/WalletFactory.d.ts +8 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/WalletFactory.js +38 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/WalletFactory.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/index.d.ts +2 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/index.js +21 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/index.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.d.ts +26 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.js +73 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/index.d.ts +10 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/index.js +37 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/evm/index.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/index.d.ts +3 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/index.js +14 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/index.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/solana/index.d.ts +27 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/solana/index.js +118 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/solana/index.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.d.ts +23 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.js +118 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/ton/index.d.ts +9 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/ton/index.js +29 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/providers/ton/index.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/types.d.ts +38 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/types.js +30 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/types.js.map +1 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/utils/index.d.ts +8 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/utils/index.js +41 -0
- package/dist/cjs/airdrop/core/useWeb3ConnectWallet/utils/index.js.map +1 -0
- package/dist/cjs/airdrop/index.d.ts +4 -46
- package/dist/cjs/airdrop/index.js +22 -241
- package/dist/cjs/airdrop/index.js.map +1 -1
- package/dist/cjs/airdrop/services/index.d.ts +33 -1
- package/dist/cjs/airdrop/services/index.js +46 -2
- package/dist/cjs/airdrop/services/index.js.map +1 -1
- package/dist/cjs/airdrop/types/index.d.ts +45 -4
- package/dist/cjs/airdrop/types/index.js +7 -1
- package/dist/cjs/airdrop/types/index.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +7 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/api-client.d.ts +1 -0
- package/dist/cjs/utils/api-client.js +2 -2
- package/dist/cjs/utils/api-client.js.map +1 -1
- package/dist/cjs/utils/utils.d.ts +1 -0
- package/dist/cjs/utils/utils.js +2 -1
- package/dist/cjs/utils/utils.js.map +1 -1
- package/dist/esm/airdrop/AirdropClient.d.ts +46 -0
- package/dist/esm/airdrop/AirdropClient.js +247 -0
- package/dist/esm/airdrop/AirdropClient.js.map +1 -0
- package/dist/esm/airdrop/SignatureAirdropClient.d.ts +39 -0
- package/dist/esm/airdrop/SignatureAirdropClient.js +181 -0
- package/dist/esm/airdrop/SignatureAirdropClient.js.map +1 -0
- package/dist/esm/airdrop/common/index.d.ts +1 -1
- package/dist/esm/airdrop/constants/index.d.ts +4 -0
- package/dist/esm/airdrop/constants/index.js +4 -0
- package/dist/esm/airdrop/constants/index.js.map +1 -1
- package/dist/esm/airdrop/core/evm/SignatureAirdropService.d.ts +23 -0
- package/dist/esm/airdrop/core/evm/SignatureAirdropService.js +67 -0
- package/dist/esm/airdrop/core/evm/SignatureAirdropService.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.d.ts +16 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.js +40 -0
- package/dist/esm/airdrop/core/evm/contracts/AirdropSignatureClient.js.map +1 -0
- package/dist/esm/airdrop/core/evm/contracts/abis/FungibleTokenECDSADistributor.json +564 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/WalletBase.d.ts +32 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/WalletBase.js +67 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/WalletBase.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/WalletFactory.d.ts +8 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/WalletFactory.js +34 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/WalletFactory.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/index.d.ts +2 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/index.js +3 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/index.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.d.ts +26 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.js +68 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/index.d.ts +10 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/index.js +31 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/evm/index.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/index.d.ts +3 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/index.js +5 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/index.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/solana/index.d.ts +27 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/solana/index.js +108 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/solana/index.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.d.ts +23 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.js +113 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/ton/index.d.ts +9 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/ton/index.js +24 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/providers/ton/index.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/types.d.ts +38 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/types.js +27 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/types.js.map +1 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/utils/index.d.ts +8 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/utils/index.js +35 -0
- package/dist/esm/airdrop/core/useWeb3ConnectWallet/utils/index.js.map +1 -0
- package/dist/esm/airdrop/index.d.ts +4 -46
- package/dist/esm/airdrop/index.js +4 -239
- package/dist/esm/airdrop/index.js.map +1 -1
- package/dist/esm/airdrop/services/index.d.ts +33 -1
- package/dist/esm/airdrop/services/index.js +40 -1
- package/dist/esm/airdrop/services/index.js.map +1 -1
- package/dist/esm/airdrop/types/index.d.ts +45 -4
- package/dist/esm/airdrop/types/index.js +6 -0
- package/dist/esm/airdrop/types/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/api-client.d.ts +1 -0
- package/dist/esm/utils/api-client.js +2 -2
- package/dist/esm/utils/api-client.js.map +1 -1
- package/dist/esm/utils/utils.d.ts +1 -0
- package/dist/esm/utils/utils.js +1 -0
- package/dist/esm/utils/utils.js.map +1 -1
- package/package.json +15 -3
- package/src/airdrop/AirdropClient.ts +307 -0
- package/src/airdrop/SignatureAirdropClient.ts +248 -0
- package/src/airdrop/constants/index.ts +5 -0
- package/src/airdrop/core/evm/SignatureAirdropService.ts +90 -0
- package/src/airdrop/core/evm/contracts/AirdropSignatureClient.ts +56 -0
- package/src/airdrop/core/evm/contracts/abis/FungibleTokenECDSADistributor.json +564 -0
- package/src/airdrop/core/useWeb3ConnectWallet/WalletBase.ts +92 -0
- package/src/airdrop/core/useWeb3ConnectWallet/WalletFactory.tsx +35 -0
- package/src/airdrop/core/useWeb3ConnectWallet/index.ts +3 -0
- package/src/airdrop/core/useWeb3ConnectWallet/providers/evm/EvmWallet.ts +93 -0
- package/src/airdrop/core/useWeb3ConnectWallet/providers/evm/index.tsx +56 -0
- package/src/airdrop/core/useWeb3ConnectWallet/providers/index.ts +4 -0
- package/src/airdrop/core/useWeb3ConnectWallet/providers/solana/index.tsx +138 -0
- package/src/airdrop/core/useWeb3ConnectWallet/providers/ton/TonWallet.ts +153 -0
- package/src/airdrop/core/useWeb3ConnectWallet/providers/ton/index.tsx +41 -0
- package/src/airdrop/core/useWeb3ConnectWallet/types.ts +45 -0
- package/src/airdrop/core/useWeb3ConnectWallet/utils/index.ts +61 -0
- package/src/airdrop/index.ts +4 -304
- package/src/airdrop/services/index.ts +92 -3
- package/src/airdrop/types/index.ts +53 -6
- package/src/index.ts +9 -1
- package/src/utils/api-client.ts +3 -2
- package/src/utils/utils.ts +2 -0
- package/tsconfig.json +2 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare enum WalletType {
|
|
2
|
+
EVM = "evm",
|
|
3
|
+
BITCOIN = "bitcoin",
|
|
4
|
+
SOLANA = "solana",
|
|
5
|
+
TON = "ton",
|
|
6
|
+
APTOS = "aptos",
|
|
7
|
+
PARTICLE = "particle-evm",
|
|
8
|
+
OKX = "okx",
|
|
9
|
+
Cyber = "cyber",
|
|
10
|
+
StarkNet = "starknet",
|
|
11
|
+
WALLETCONNECT = "walletconnect",
|
|
12
|
+
Cardano = "cardano"
|
|
13
|
+
}
|
|
14
|
+
export declare enum ChainType {
|
|
15
|
+
Evm = "evm",
|
|
16
|
+
Ton = "ton",
|
|
17
|
+
Solana = "solana"
|
|
18
|
+
}
|
|
19
|
+
export declare enum ExtendedWalletType {
|
|
20
|
+
UNISAT = "unisat",
|
|
21
|
+
OKXBTC = "okx_btc"
|
|
22
|
+
}
|
|
23
|
+
export type ProviderType = WalletType | ExtendedWalletType;
|
|
24
|
+
export type ISignResult = {
|
|
25
|
+
message: string;
|
|
26
|
+
signature: string;
|
|
27
|
+
[key: string]: any;
|
|
28
|
+
} | undefined;
|
|
29
|
+
export interface ISignInMessage {
|
|
30
|
+
domain?: string;
|
|
31
|
+
version?: string;
|
|
32
|
+
nonce: string;
|
|
33
|
+
issuedAt: string;
|
|
34
|
+
statement: string;
|
|
35
|
+
chainId?: number | string;
|
|
36
|
+
uri?: string;
|
|
37
|
+
address?: string;
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtendedWalletType = exports.ChainType = exports.WalletType = void 0;
|
|
4
|
+
var WalletType;
|
|
5
|
+
(function (WalletType) {
|
|
6
|
+
WalletType["EVM"] = "evm";
|
|
7
|
+
WalletType["BITCOIN"] = "bitcoin";
|
|
8
|
+
WalletType["SOLANA"] = "solana";
|
|
9
|
+
WalletType["TON"] = "ton";
|
|
10
|
+
WalletType["APTOS"] = "aptos";
|
|
11
|
+
WalletType["PARTICLE"] = "particle-evm";
|
|
12
|
+
WalletType["OKX"] = "okx";
|
|
13
|
+
WalletType["Cyber"] = "cyber";
|
|
14
|
+
WalletType["StarkNet"] = "starknet";
|
|
15
|
+
WalletType["WALLETCONNECT"] = "walletconnect";
|
|
16
|
+
WalletType["Cardano"] = "cardano";
|
|
17
|
+
})(WalletType || (exports.WalletType = WalletType = {}));
|
|
18
|
+
var ChainType;
|
|
19
|
+
(function (ChainType) {
|
|
20
|
+
ChainType["Evm"] = "evm";
|
|
21
|
+
ChainType["Ton"] = "ton";
|
|
22
|
+
// Starknet = 'starknet',
|
|
23
|
+
ChainType["Solana"] = "solana";
|
|
24
|
+
})(ChainType || (exports.ChainType = ChainType = {}));
|
|
25
|
+
var ExtendedWalletType;
|
|
26
|
+
(function (ExtendedWalletType) {
|
|
27
|
+
ExtendedWalletType["UNISAT"] = "unisat";
|
|
28
|
+
ExtendedWalletType["OKXBTC"] = "okx_btc";
|
|
29
|
+
})(ExtendedWalletType || (exports.ExtendedWalletType = ExtendedWalletType = {}));
|
|
30
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/airdrop/core/useWeb3ConnectWallet/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAYX;AAZD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;IACjB,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,uCAAyB,CAAA;IACzB,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,mCAAqB,CAAA;IACrB,6CAA+B,CAAA;IAC/B,iCAAmB,CAAA;AACrB,CAAC,EAZW,UAAU,0BAAV,UAAU,QAYrB;AAED,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,wBAAW,CAAA;IACX,yBAAyB;IACzB,8BAAiB,CAAA;AACnB,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB;AACD,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,wCAAkB,CAAA;AACpB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ISignInMessage } from '../types';
|
|
2
|
+
export declare const getCustomNaNoId: () => string;
|
|
3
|
+
export declare function prepareSignMessage({ chainId, address, statement }: {
|
|
4
|
+
address: string;
|
|
5
|
+
chainId: number | string;
|
|
6
|
+
statement?: string;
|
|
7
|
+
}): ISignInMessage;
|
|
8
|
+
export declare const get4361Message: ({ domain, version, nonce, issuedAt, statement, chainId, uri, address }: ISignInMessage) => string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.get4361Message = exports.getCustomNaNoId = void 0;
|
|
4
|
+
exports.prepareSignMessage = prepareSignMessage;
|
|
5
|
+
const nanoid_1 = require("nanoid");
|
|
6
|
+
const getCustomNaNoId = () => {
|
|
7
|
+
const nanoid = (0, nanoid_1.customAlphabet)('1234567890abcdefghijklmnopqrstuvwxyz', 10);
|
|
8
|
+
return nanoid();
|
|
9
|
+
};
|
|
10
|
+
exports.getCustomNaNoId = getCustomNaNoId;
|
|
11
|
+
function prepareSignMessage({ chainId, address, statement }) {
|
|
12
|
+
return {
|
|
13
|
+
statement: statement || 'Welcome to EthSign',
|
|
14
|
+
chainId: chainId,
|
|
15
|
+
address: address,
|
|
16
|
+
issuedAt: new Date().toISOString(),
|
|
17
|
+
domain: window.location.host,
|
|
18
|
+
uri: window.location.origin,
|
|
19
|
+
version: '1',
|
|
20
|
+
nonce: (0, exports.getCustomNaNoId)()
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const get4361Message = ({ domain, version, nonce, issuedAt, statement, chainId, uri, address }) => {
|
|
24
|
+
const header = `${domain} wants you to sign in with your Ethereum account:`;
|
|
25
|
+
const uriField = `URI: ${uri}`;
|
|
26
|
+
let prefix = [header, address].join('\n');
|
|
27
|
+
const versionField = `Version: ${version}`;
|
|
28
|
+
// const addressField = `Address: ` + address;
|
|
29
|
+
const chainField = `Chain ID: ` + chainId || '1';
|
|
30
|
+
const nonceField = `Nonce: ${nonce}`;
|
|
31
|
+
const suffixArray = [uriField, versionField, chainField, nonceField];
|
|
32
|
+
suffixArray.push(`Issued At: ${issuedAt}`);
|
|
33
|
+
const suffix = suffixArray.join('\n');
|
|
34
|
+
prefix = [prefix, statement].join('\n\n');
|
|
35
|
+
if (statement) {
|
|
36
|
+
prefix += '\n';
|
|
37
|
+
}
|
|
38
|
+
return [prefix, suffix].join('\n');
|
|
39
|
+
};
|
|
40
|
+
exports.get4361Message = get4361Message;
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/airdrop/core/useWeb3ConnectWallet/utils/index.ts"],"names":[],"mappings":";;;AAQA,gDAmBC;AA1BD,mCAAwC;AAEjC,MAAM,eAAe,GAAG,GAAW,EAAE;IAC1C,MAAM,MAAM,GAAG,IAAA,uBAAc,EAAC,sCAAsC,EAAE,EAAE,CAAC,CAAC;IAC1E,OAAO,MAAM,EAAE,CAAC;AAClB,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B;AAEF,SAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,OAAO,EACP,SAAS,EAKV;IACC,OAAO;QACL,SAAS,EAAE,SAAS,IAAI,oBAAoB;QAC5C,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAClC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;QAC5B,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM;QAC3B,OAAO,EAAE,GAAG;QACZ,KAAK,EAAE,IAAA,uBAAe,GAAE;KACzB,CAAC;AACJ,CAAC;AAEM,MAAM,cAAc,GAAG,CAAC,EAC7B,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,EACH,OAAO,EACQ,EAAU,EAAE;IAC3B,MAAM,MAAM,GAAG,GAAG,MAAM,mDAAmD,CAAC;IAC5E,MAAM,QAAQ,GAAG,QAAQ,GAAG,EAAE,CAAC;IAC/B,IAAI,MAAM,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,YAAY,GAAG,YAAY,OAAO,EAAE,CAAC;IAE3C,8CAA8C;IAE9C,MAAM,UAAU,GAAG,YAAY,GAAG,OAAO,IAAI,GAAG,CAAC;IAEjD,MAAM,UAAU,GAAG,UAAU,KAAK,EAAE,CAAC;IAErC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAErE,WAAW,CAAC,IAAI,CAAC,cAAc,QAAQ,EAAE,CAAC,CAAC;IAE3C,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,IAAI,IAAI,CAAC;IACjB,CAAC;IACD,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC,CAAC;AA/BW,QAAA,cAAc,kBA+BzB"}
|
|
@@ -1,46 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
private tonClient?;
|
|
6
|
-
private slug?;
|
|
7
|
-
private projectId?;
|
|
8
|
-
private endpoint?;
|
|
9
|
-
private project;
|
|
10
|
-
protected claims?: IAirdropClaim[];
|
|
11
|
-
private projectPromise;
|
|
12
|
-
private claimHook;
|
|
13
|
-
private contractConfig;
|
|
14
|
-
constructor(params: IAirdropOptions);
|
|
15
|
-
setTonClient(tonClient: TonClient): void;
|
|
16
|
-
private getTonClient;
|
|
17
|
-
private fetchProjectFromSlug;
|
|
18
|
-
private fetchProjectDetails;
|
|
19
|
-
protected initializeProjects(address?: string): Promise<void>;
|
|
20
|
-
getProjectInfo(): Promise<IProject>;
|
|
21
|
-
getAirdropClaims(data: {
|
|
22
|
-
address: string;
|
|
23
|
-
}): Promise<IAirdropClaim[]>;
|
|
24
|
-
getStrategy(walletClient?: IWalletClient): Promise<IAirdropStrategy>;
|
|
25
|
-
private getClaimDataById;
|
|
26
|
-
setClaimHook(fn: (v: any) => any): void;
|
|
27
|
-
private getDefaultExtraData;
|
|
28
|
-
private calculateClaimFee;
|
|
29
|
-
claimAirdrop({ claimId, walletClient }: {
|
|
30
|
-
claimId: string;
|
|
31
|
-
walletClient: IWalletClient;
|
|
32
|
-
}, options?: {
|
|
33
|
-
onLoading?: () => void;
|
|
34
|
-
}): Promise<any>;
|
|
35
|
-
checkClaimed(claimId: string): Promise<boolean>;
|
|
36
|
-
private getContractConfig;
|
|
37
|
-
getVersion(): Promise<string>;
|
|
38
|
-
getPaused(): Promise<boolean>;
|
|
39
|
-
getClaimFee(amount?: bigint): Promise<string | bigint>;
|
|
40
|
-
batchCheckClaimed(): Promise<{
|
|
41
|
-
result: boolean;
|
|
42
|
-
status: string;
|
|
43
|
-
}[]>;
|
|
44
|
-
getNFT(): Promise<string>;
|
|
45
|
-
getKycThreshold(): Promise<bigint>;
|
|
46
|
-
}
|
|
1
|
+
export { AirdropClient } from './AirdropClient';
|
|
2
|
+
export { SignatureAirdropClient } from './SignatureAirdropClient';
|
|
3
|
+
export { CONST } from './constants';
|
|
4
|
+
export * from './core/useWeb3ConnectWallet';
|
|
@@ -1,244 +1,25 @@
|
|
|
1
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
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AirdropClient = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
slug;
|
|
12
|
-
projectId;
|
|
13
|
-
endpoint;
|
|
14
|
-
project;
|
|
15
|
-
claims;
|
|
16
|
-
projectPromise;
|
|
17
|
-
claimHook;
|
|
18
|
-
contractConfig = null;
|
|
19
|
-
constructor(params) {
|
|
20
|
-
if ('slug' in params) {
|
|
21
|
-
this.slug = params.slug;
|
|
22
|
-
}
|
|
23
|
-
this.projectId = params.projectId;
|
|
24
|
-
this.endpoint = params.endpoint;
|
|
25
|
-
this.projectPromise = this.initializeProjects();
|
|
26
|
-
}
|
|
27
|
-
setTonClient(tonClient) {
|
|
28
|
-
this.tonClient = tonClient;
|
|
29
|
-
}
|
|
30
|
-
getTonClient() {
|
|
31
|
-
if (!this.tonClient) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
return this.tonClient;
|
|
35
|
-
}
|
|
36
|
-
async fetchProjectFromSlug(address) {
|
|
37
|
-
if (!this.slug)
|
|
38
|
-
return undefined;
|
|
39
|
-
const res = await (0, services_1.getAirdropPro)(this.slug, this.endpoint);
|
|
40
|
-
const projectMap = res?.childProjectMapping || {};
|
|
41
|
-
return (0, common_1.getTonProjectIdByAddress)({
|
|
42
|
-
address,
|
|
43
|
-
slug: this.slug,
|
|
44
|
-
data: projectMap
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
async fetchProjectDetails(projectId) {
|
|
48
|
-
this.project = await (0, services_1.getAirdropProject)(projectId, this.endpoint);
|
|
49
|
-
}
|
|
50
|
-
async initializeProjects(address) {
|
|
51
|
-
try {
|
|
52
|
-
let projectId = this.projectId;
|
|
53
|
-
// If slug is provided, try to fetch project ID from slug
|
|
54
|
-
if (!projectId) {
|
|
55
|
-
projectId = await this.fetchProjectFromSlug(address);
|
|
56
|
-
}
|
|
57
|
-
if (!projectId) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
// Fetch project details
|
|
61
|
-
await this.fetchProjectDetails(projectId);
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
throw new Error(`Failed to initialize project: ${error.message}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
async getProjectInfo() {
|
|
68
|
-
await this.projectPromise;
|
|
69
|
-
if (!this.project)
|
|
70
|
-
throw new Error('Project not found');
|
|
71
|
-
return this.project;
|
|
72
|
-
}
|
|
73
|
-
async getAirdropClaims(data) {
|
|
74
|
-
if (this.slug) {
|
|
75
|
-
await this.initializeProjects(data.address); // Fetch project details by address & slug
|
|
76
|
-
}
|
|
77
|
-
const project = await this.getProjectInfo();
|
|
78
|
-
const res = await (0, services_1.getAirdropQuery)({
|
|
79
|
-
recipient: data.address,
|
|
80
|
-
projectId: project.id,
|
|
81
|
-
recipientType: project.recipientType
|
|
82
|
-
}, this.endpoint);
|
|
83
|
-
const claimsRes = res.claims?.map((it) => ({
|
|
84
|
-
...it,
|
|
85
|
-
project: project,
|
|
86
|
-
claimId: project.chainType === types_1.ChainType.Evm ? `${project.id}:${it.leaf}` : `${project.id}:${it.index}`
|
|
87
|
-
}));
|
|
88
|
-
this.claims = claimsRes;
|
|
89
|
-
return this.claims;
|
|
90
|
-
}
|
|
91
|
-
async getStrategy(walletClient) {
|
|
92
|
-
const project = await this.getProjectInfo();
|
|
93
|
-
const version = this.contractConfig?.version || undefined;
|
|
94
|
-
const hasWallet = !!walletClient;
|
|
95
|
-
// Try to get cached strategy
|
|
96
|
-
let strategy = StrategyCache_1.strategyCache.getStrategy(project.contractAddress, project.chainId, project.chainType, hasWallet);
|
|
97
|
-
if (!strategy) {
|
|
98
|
-
// Create new strategy if not cached
|
|
99
|
-
strategy = AirdropStrategyFactory_1.AirdropStrategyFactory.createStrategy({
|
|
100
|
-
chainType: project.chainType,
|
|
101
|
-
contractAddress: project.contractAddress,
|
|
102
|
-
chainId: project.chainId,
|
|
103
|
-
walletClient,
|
|
104
|
-
tonClient: this.getTonClient(),
|
|
105
|
-
version
|
|
106
|
-
});
|
|
107
|
-
// Initialize the strategy
|
|
108
|
-
await strategy.initialize(walletClient);
|
|
109
|
-
// Cache the initialized strategy
|
|
110
|
-
StrategyCache_1.strategyCache.setStrategy(project.contractAddress, project.chainId, project.chainType, strategy, hasWallet);
|
|
111
|
-
}
|
|
112
|
-
else if (hasWallet) {
|
|
113
|
-
// If we have a wallet and the strategy exists, just initialize with the new wallet
|
|
114
|
-
await strategy.initialize(walletClient);
|
|
115
|
-
}
|
|
116
|
-
return strategy;
|
|
117
|
-
}
|
|
118
|
-
getClaimDataById(claimId) {
|
|
119
|
-
const claimData = this.claims?.find((it) => it.claimId === claimId);
|
|
120
|
-
if (!claimData)
|
|
121
|
-
throw new Error('Claim data not found');
|
|
122
|
-
return claimData;
|
|
123
|
-
}
|
|
124
|
-
setClaimHook(fn) {
|
|
125
|
-
this.claimHook = fn;
|
|
126
|
-
}
|
|
127
|
-
getDefaultExtraData() {
|
|
128
|
-
return {
|
|
129
|
-
isLegacy: true,
|
|
130
|
-
attestationId: BigInt(1)
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
async calculateClaimFee(project, claimAmount) {
|
|
134
|
-
if (project.chainType === types_1.ChainType.Evm) {
|
|
135
|
-
const version = await this.getVersion();
|
|
136
|
-
const isNativeFreeVersion = project.tokenType === types_1.ETokenType.Native &&
|
|
137
|
-
[types_1.EvmAirdropVersionEnum.V3, types_1.EvmAirdropVersionEnum.V4].includes(version);
|
|
138
|
-
return isNativeFreeVersion ? undefined : await this.getClaimFee(BigInt(claimAmount));
|
|
139
|
-
}
|
|
140
|
-
if (project.chainType === types_1.ChainType.Ton) {
|
|
141
|
-
return await this.getClaimFee(BigInt(claimAmount));
|
|
142
|
-
}
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
async claimAirdrop({ claimId, walletClient }, options) {
|
|
146
|
-
// Get claim data and initialize strategy
|
|
147
|
-
const claimData = this.getClaimDataById(claimId);
|
|
148
|
-
const strategy = await this.getStrategy(walletClient);
|
|
149
|
-
const project = await this.getProjectInfo();
|
|
150
|
-
// Process extra data
|
|
151
|
-
const extraData = project.chainType === types_1.ChainType.Ton
|
|
152
|
-
? undefined
|
|
153
|
-
: this.claimHook
|
|
154
|
-
? this.claimHook(claimData)
|
|
155
|
-
: this.getDefaultExtraData();
|
|
156
|
-
// Calculate claim value based on project type
|
|
157
|
-
const value = await this.calculateClaimFee(project, claimData.amount);
|
|
158
|
-
// Execute claim with processed data
|
|
159
|
-
return strategy.claim({
|
|
160
|
-
...claimData,
|
|
161
|
-
extraData,
|
|
162
|
-
value
|
|
163
|
-
}, options);
|
|
164
|
-
}
|
|
165
|
-
async checkClaimed(claimId) {
|
|
166
|
-
const claimData = this.getClaimDataById(claimId);
|
|
167
|
-
const strategy = await this.getStrategy();
|
|
168
|
-
return strategy.checkClaimed(claimData);
|
|
169
|
-
}
|
|
170
|
-
async getContractConfig() {
|
|
171
|
-
try {
|
|
172
|
-
const project = await this.getProjectInfo();
|
|
173
|
-
if (!this.contractConfig) {
|
|
174
|
-
this.contractConfig = await (0, services_1.getAirdropContractConfig)({
|
|
175
|
-
chainId: project.chainId,
|
|
176
|
-
chainType: project.chainType,
|
|
177
|
-
contractAddress: project.contractAddress
|
|
178
|
-
}, this.endpoint);
|
|
179
|
-
}
|
|
180
|
-
return this.contractConfig;
|
|
181
|
-
}
|
|
182
|
-
catch (error) {
|
|
183
|
-
console.error('Error fetching contract config:', error);
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
async getVersion() {
|
|
188
|
-
const config = await this.getContractConfig();
|
|
189
|
-
if (config?.version) {
|
|
190
|
-
return config.version;
|
|
191
|
-
}
|
|
192
|
-
const strategy = await this.getStrategy();
|
|
193
|
-
return strategy.getVersion();
|
|
194
|
-
}
|
|
195
|
-
async getPaused() {
|
|
196
|
-
const config = await this.getContractConfig();
|
|
197
|
-
if (config && config?.paused !== null) {
|
|
198
|
-
return config.paused;
|
|
199
|
-
}
|
|
200
|
-
const strategy = await this.getStrategy();
|
|
201
|
-
if (!strategy.getPaused) {
|
|
202
|
-
throw new Error('getPaused is not supported for this chain');
|
|
203
|
-
}
|
|
204
|
-
return strategy.getPaused();
|
|
205
|
-
}
|
|
206
|
-
async getClaimFee(amount) {
|
|
207
|
-
const config = await this.getContractConfig();
|
|
208
|
-
if (config?.claimFee) {
|
|
209
|
-
return config.claimFee;
|
|
210
|
-
}
|
|
211
|
-
const strategy = await this.getStrategy();
|
|
212
|
-
if (!strategy.getClaimFee) {
|
|
213
|
-
throw new Error('getClaimFee is not supported for this chain');
|
|
214
|
-
}
|
|
215
|
-
return strategy.getClaimFee(this.project?.contractAddress || '', amount || BigInt(0));
|
|
216
|
-
}
|
|
217
|
-
// params claimId[]
|
|
218
|
-
async batchCheckClaimed() {
|
|
219
|
-
const strategy = await this.getStrategy();
|
|
220
|
-
if (!strategy.batchCheckClaimed) {
|
|
221
|
-
throw new Error('batchCheckClaimed is not supported for this chain');
|
|
222
|
-
}
|
|
223
|
-
const leafs = this.claims?.map((it) => it.leaf);
|
|
224
|
-
if (!leafs)
|
|
225
|
-
return [];
|
|
226
|
-
return strategy.batchCheckClaimed(leafs);
|
|
227
|
-
}
|
|
228
|
-
async getNFT() {
|
|
229
|
-
const strategy = await this.getStrategy();
|
|
230
|
-
if (!strategy.getNFT) {
|
|
231
|
-
throw new Error('getNFT is not supported for this chain');
|
|
232
|
-
}
|
|
233
|
-
return strategy.getNFT();
|
|
234
|
-
}
|
|
235
|
-
async getKycThreshold() {
|
|
236
|
-
const strategy = await this.getStrategy();
|
|
237
|
-
if (!strategy.getKycThreshold) {
|
|
238
|
-
throw new Error('getKycThreshold is not supported for this chain');
|
|
239
|
-
}
|
|
240
|
-
return strategy.getKycThreshold();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
exports.AirdropClient = AirdropClient;
|
|
17
|
+
exports.CONST = exports.SignatureAirdropClient = exports.AirdropClient = void 0;
|
|
18
|
+
var AirdropClient_1 = require("./AirdropClient");
|
|
19
|
+
Object.defineProperty(exports, "AirdropClient", { enumerable: true, get: function () { return AirdropClient_1.AirdropClient; } });
|
|
20
|
+
var SignatureAirdropClient_1 = require("./SignatureAirdropClient");
|
|
21
|
+
Object.defineProperty(exports, "SignatureAirdropClient", { enumerable: true, get: function () { return SignatureAirdropClient_1.SignatureAirdropClient; } });
|
|
22
|
+
var constants_1 = require("./constants");
|
|
23
|
+
Object.defineProperty(exports, "CONST", { enumerable: true, get: function () { return constants_1.CONST; } });
|
|
24
|
+
__exportStar(require("./core/useWeb3ConnectWallet"), exports);
|
|
244
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/airdrop/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/airdrop/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAE/B,yCAAoC;AAA3B,kGAAA,KAAK,OAAA;AACd,8DAA4C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAirdropData, IContractConfig, IProject } from '../types';
|
|
1
|
+
import { AirdropSigIdentityTypeEnum, IAirdropData, IAirdropSignatureData, IClaimSignature, IContractConfig, IProject } from '../types';
|
|
2
2
|
export { TonWalletService } from './wallet-service/ton';
|
|
3
3
|
export declare const getAirdropProject: (projectId: string, baseURL?: string) => Promise<IProject>;
|
|
4
4
|
export declare const getAirdropProjectId: (data: {
|
|
@@ -26,3 +26,35 @@ export declare const getJettonInfo: (data: {
|
|
|
26
26
|
address: string;
|
|
27
27
|
isTestnet: "true" | "false";
|
|
28
28
|
}, baseURL?: string) => Promise<any>;
|
|
29
|
+
interface SidResponse {
|
|
30
|
+
sid: string;
|
|
31
|
+
}
|
|
32
|
+
interface TwitterConnectParams {
|
|
33
|
+
code: string;
|
|
34
|
+
projectId: string;
|
|
35
|
+
}
|
|
36
|
+
interface WalletBindParams {
|
|
37
|
+
projectId: string;
|
|
38
|
+
key: string;
|
|
39
|
+
signature: string;
|
|
40
|
+
message: string;
|
|
41
|
+
timestamp: number;
|
|
42
|
+
recipientType: string;
|
|
43
|
+
}
|
|
44
|
+
export declare const connectTwitter: (data: TwitterConnectParams, baseURL?: string) => Promise<SidResponse>;
|
|
45
|
+
export declare const checkEligibility: (data: {
|
|
46
|
+
projectId: string;
|
|
47
|
+
}, baseURL?: string) => Promise<IAirdropSignatureData>;
|
|
48
|
+
export declare const bindWallet: (data: WalletBindParams, baseURL?: string) => Promise<SidResponse>;
|
|
49
|
+
interface DisconnectParams {
|
|
50
|
+
projectId: string;
|
|
51
|
+
recipientType: AirdropSigIdentityTypeEnum;
|
|
52
|
+
recipient?: string;
|
|
53
|
+
}
|
|
54
|
+
export declare const disconnectRecipient: (data: DisconnectParams, baseURL?: string) => Promise<void>;
|
|
55
|
+
export declare const checkGetSignatures: (data: {
|
|
56
|
+
projectId: string;
|
|
57
|
+
claimIds: string[];
|
|
58
|
+
}, baseURL?: string) => Promise<{
|
|
59
|
+
signatures: IClaimSignature[];
|
|
60
|
+
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getJettonInfo = exports.getAirdropContractConfig = exports.getAirdropQuery = exports.getAirdropPro = exports.getAirdropProjectId = exports.getAirdropProject = exports.TonWalletService = void 0;
|
|
3
|
+
exports.checkGetSignatures = exports.disconnectRecipient = exports.bindWallet = exports.checkEligibility = exports.connectTwitter = exports.getJettonInfo = exports.getAirdropContractConfig = exports.getAirdropQuery = exports.getAirdropPro = exports.getAirdropProjectId = exports.getAirdropProject = exports.TonWalletService = void 0;
|
|
4
4
|
const api_client_1 = require("../../utils/api-client");
|
|
5
5
|
const utils_1 = require("../../utils/utils");
|
|
6
6
|
var ton_1 = require("./wallet-service/ton");
|
|
@@ -12,7 +12,7 @@ const getAirdropProject = async (projectId, baseURL) => {
|
|
|
12
12
|
const client = createApiClient(baseURL);
|
|
13
13
|
const res = await client.get(`/airdrop-open/projects/${projectId}`);
|
|
14
14
|
if (!res)
|
|
15
|
-
return res; // res
|
|
15
|
+
return res; // res is null
|
|
16
16
|
const projectConfig = res?.themeConf;
|
|
17
17
|
const blockCountries = (0, utils_1.safeParseJSON)(projectConfig?.blockCountries);
|
|
18
18
|
return {
|
|
@@ -46,4 +46,48 @@ const getJettonInfo = async (data, baseURL) => {
|
|
|
46
46
|
return client.get(`/airdrop-open/jetton/${data.address}?isTestnet=${data.isTestnet}`);
|
|
47
47
|
};
|
|
48
48
|
exports.getJettonInfo = getJettonInfo;
|
|
49
|
+
const getSidHeader = (projectId) => ({
|
|
50
|
+
sid: window.localStorage.getItem(`sid_${projectId}`) || ''
|
|
51
|
+
});
|
|
52
|
+
const connectTwitter = async (data, baseURL) => {
|
|
53
|
+
const client = createApiClient(baseURL);
|
|
54
|
+
return client.post('/airdrop-open/connect-twitter', data, {
|
|
55
|
+
headers: getSidHeader(data.projectId)
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
exports.connectTwitter = connectTwitter;
|
|
59
|
+
const checkEligibility = async (data, baseURL) => {
|
|
60
|
+
const headers = getSidHeader(data.projectId);
|
|
61
|
+
if (!headers.sid)
|
|
62
|
+
return {
|
|
63
|
+
claims: [],
|
|
64
|
+
identities: []
|
|
65
|
+
};
|
|
66
|
+
const client = createApiClient(baseURL);
|
|
67
|
+
return client.post('/airdrop-open/check-eligibility', data, {
|
|
68
|
+
headers: headers
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
exports.checkEligibility = checkEligibility;
|
|
72
|
+
const bindWallet = async (data, baseURL) => {
|
|
73
|
+
const client = createApiClient(baseURL);
|
|
74
|
+
return client.post('/airdrop-open/connect-wallet', data, {
|
|
75
|
+
headers: getSidHeader(data.projectId)
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
exports.bindWallet = bindWallet;
|
|
79
|
+
const disconnectRecipient = async (data, baseURL) => {
|
|
80
|
+
const client = createApiClient(baseURL);
|
|
81
|
+
return client.post('/airdrop-open/disconnect', data, {
|
|
82
|
+
headers: getSidHeader(data.projectId)
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
exports.disconnectRecipient = disconnectRecipient;
|
|
86
|
+
const checkGetSignatures = async (data, baseURL) => {
|
|
87
|
+
const client = createApiClient(baseURL);
|
|
88
|
+
return client.post('/airdrop-open/check-get-signatures', data, {
|
|
89
|
+
headers: getSidHeader(data.projectId)
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
exports.checkGetSignatures = checkGetSignatures;
|
|
49
93
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/airdrop/services/index.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AACnD,6CAAkD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/aird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,IAAI,EAAE;QAC7D,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,kBAAkB,sBAW7B"}
|
|
@@ -55,10 +55,25 @@ export interface IProject {
|
|
|
55
55
|
blockCountries: Record<string, string>;
|
|
56
56
|
themeConf: ThemeConfig | null;
|
|
57
57
|
version: string;
|
|
58
|
-
extra?:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
extra?: IProjectExtra;
|
|
59
|
+
identities: Identity[];
|
|
60
|
+
projectTag: string;
|
|
61
|
+
}
|
|
62
|
+
export interface Identity {
|
|
63
|
+
identityType: string;
|
|
64
|
+
authorizeUrl?: string;
|
|
65
|
+
}
|
|
66
|
+
export declare enum AirdropSigIdentityTypeEnum {
|
|
67
|
+
Twitter = "X Account",
|
|
68
|
+
SolanaWallet = "Solana Wallet",
|
|
69
|
+
EVMWallet = "EVM Wallet"
|
|
70
|
+
}
|
|
71
|
+
export interface IProjectExtra {
|
|
72
|
+
kyc: boolean;
|
|
73
|
+
tag: string;
|
|
74
|
+
seed: number;
|
|
75
|
+
signer: string;
|
|
76
|
+
identities: string[];
|
|
62
77
|
}
|
|
63
78
|
export declare enum ETokenType {
|
|
64
79
|
Erc20 = "ERC20",
|
|
@@ -84,9 +99,34 @@ export type IAirdropClaim = {
|
|
|
84
99
|
expired?: boolean;
|
|
85
100
|
project: IProject;
|
|
86
101
|
};
|
|
102
|
+
export type IAirdropSignatureClaim = {
|
|
103
|
+
percent: number;
|
|
104
|
+
unlockingAt: number;
|
|
105
|
+
claimDeadline: number;
|
|
106
|
+
value: string;
|
|
107
|
+
recipient: string;
|
|
108
|
+
recipientType: string;
|
|
109
|
+
claimId: string;
|
|
110
|
+
data?: string;
|
|
111
|
+
signature?: string;
|
|
112
|
+
claimed?: boolean;
|
|
113
|
+
};
|
|
114
|
+
export interface IAirdropSignatureIdentity {
|
|
115
|
+
type: AirdropSigIdentityTypeEnum;
|
|
116
|
+
value: string;
|
|
117
|
+
}
|
|
87
118
|
export interface IAirdropData {
|
|
88
119
|
claims: IAirdropClaim[];
|
|
89
120
|
}
|
|
121
|
+
export interface IAirdropSignatureData {
|
|
122
|
+
claims: IAirdropSignatureClaim[];
|
|
123
|
+
identities: IAirdropSignatureIdentity[];
|
|
124
|
+
}
|
|
125
|
+
export interface IClaimSignature {
|
|
126
|
+
claimId: string;
|
|
127
|
+
data: string;
|
|
128
|
+
signature: string;
|
|
129
|
+
}
|
|
90
130
|
export declare enum TonAirdropVersionEnum {
|
|
91
131
|
V1 = "1.0.0",
|
|
92
132
|
V2 = "2.0.0",
|
|
@@ -102,6 +142,7 @@ export type IWalletClient = TonConnectUI | ViemWalletClient;
|
|
|
102
142
|
export type IAirdropService = TonAirdropService | EvmAirdropService;
|
|
103
143
|
type BaseAirdropOptions = {
|
|
104
144
|
endpoint?: string;
|
|
145
|
+
project?: IProject;
|
|
105
146
|
};
|
|
106
147
|
type ProjectIdOptions = BaseAirdropOptions & {
|
|
107
148
|
projectId: string;
|