@sign-global/tokentable-core 1.2.1 → 1.3.0
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/constants/chain-config.ts +2 -2
- package/src/constants/index.ts +1 -0
- package/src/contracts/sui/BaseDistributorClient.ts +0 -7
- package/src/contracts/sui/DistributorWithFeeClient.ts +0 -1
- package/src/services/airdrop/index.ts +7 -0
- package/src/types/index.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @sign-global/tokentable-core
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- feat: add Discord OAuth support
|
|
8
|
+
|
|
9
|
+
## 1.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- refactor: update Sui contract addresses and remove debug logs
|
|
14
|
+
|
|
3
15
|
## 1.2.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1388,6 +1388,7 @@ declare const SupportedChains: ({
|
|
|
1388
1388
|
declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
1389
1389
|
declare const CONST: {
|
|
1390
1390
|
readonly TWITTER_AUTH_SUCCESS: "twitter:auth:success";
|
|
1391
|
+
readonly DISCORD_AUTH_SUCCESS: "discord:auth:success";
|
|
1391
1392
|
readonly GOOGLE_AUTH_SUCCESS: "google:auth:success";
|
|
1392
1393
|
readonly WELCOME_SIGNATURE_STATEMENT: "Welcome to TokenTable!";
|
|
1393
1394
|
};
|
|
@@ -1846,7 +1847,8 @@ declare enum AirdropSigIdentityTypeEnum {
|
|
|
1846
1847
|
SolanaWallet = "Solana Wallet",
|
|
1847
1848
|
EVMWallet = "EVM Wallet",
|
|
1848
1849
|
TONWallet = "TON Wallet",
|
|
1849
|
-
Google = "Google Account"
|
|
1850
|
+
Google = "Google Account",
|
|
1851
|
+
Discord = "Discord Account"
|
|
1850
1852
|
}
|
|
1851
1853
|
interface IProjectExtra {
|
|
1852
1854
|
kyc: boolean;
|
|
@@ -2094,6 +2096,7 @@ interface WalletBindParams {
|
|
|
2094
2096
|
}
|
|
2095
2097
|
declare const connectTwitter: (data: SocialConnectParams, baseURL?: string) => Promise<SidResponse>;
|
|
2096
2098
|
declare const connectGoogleApi: (data: SocialConnectParams, baseURL?: string) => Promise<SidResponse>;
|
|
2099
|
+
declare const connectDiscordApi: (data: SocialConnectParams, baseURL?: string) => Promise<SidResponse>;
|
|
2097
2100
|
declare const checkEligibility: (data: {
|
|
2098
2101
|
projectId: string;
|
|
2099
2102
|
}, baseURL?: string) => Promise<IAirdropSignatureData>;
|
|
@@ -2191,4 +2194,4 @@ declare const getAvailableClaimAmountForSignature: ({ contractAddress, chainId,
|
|
|
2191
2194
|
}[];
|
|
2192
2195
|
}) => Promise<string | 0>;
|
|
2193
2196
|
|
|
2194
|
-
export { AirdropSigIdentityTypeEnum, ApiClient, type ApiClientOptions, type ApiRequestOptions, CONST, ChainConfig, type ChainId, ChainType, ETokenType, ErrorCode, AirdropService$2 as EvmAirdropService, EvmAirdropVersionEnum, type EvmContractClientOption, SignatureAirdropService$2 as EvmSignatureAirdropService, type FetchTokenMetadataOptions, type FetchTokenVersionOptions, type IAirdropClaim, type IAirdropClaimData, type IAirdropData, type IAirdropOptions, type IAirdropService, type IAirdropSignatureClaim, type IAirdropSignatureData, type IAirdropSignatureIdentity, type IClaimSignature, type IContractConfig, type IExtraData, type IProject, type IProjectExtra, type ISignatureClaimData, type IWalletClient, type Identity, AirdropService$1 as SolanaAirdropService, SignatureAirdropService$1 as SolanaSignatureAirdropService, SplTokenVersion, SignatureAirdropService as SuiSignatureAirdropService, type SupportedChainType, SupportedChains, type ThemeConfig, AirdropService as TonAirdropService, TonAirdropVersionEnum, TonWalletService, ZERO_ADDRESS, apiClient, batchCheckClaimedForSignature, bindWallet, checkEligibility, checkGetSignatures, cleanUrlParams, clusterApiUrl, connectGoogleApi, connectTwitter, delay, disconnectRecipient, fetchTokenVersion, flipAddressType, getAirdropContractConfig, getAirdropPro, getAirdropProject, getAirdropProjectId, getAirdropQuery, getAvailableClaimAmountForSignature, getChainById, getChainConfig, getChainRpc, getCustomNaNoId, getJettonInfo, getOrCreateAssociatedTokenAccount, getTonProjectIdByAddress, hexStrToU8Array, isBeforeByUnix, isGreaterThan, isMobile, mevmDevNet, retry, safeParseJSON, safePlus, signBrBTestnet, solanaDevNet, solanaMainNet, suiMainNet, suiTestNet, tonMainNet, tonTestNet };
|
|
2197
|
+
export { AirdropSigIdentityTypeEnum, ApiClient, type ApiClientOptions, type ApiRequestOptions, CONST, ChainConfig, type ChainId, ChainType, ETokenType, ErrorCode, AirdropService$2 as EvmAirdropService, EvmAirdropVersionEnum, type EvmContractClientOption, SignatureAirdropService$2 as EvmSignatureAirdropService, type FetchTokenMetadataOptions, type FetchTokenVersionOptions, type IAirdropClaim, type IAirdropClaimData, type IAirdropData, type IAirdropOptions, type IAirdropService, type IAirdropSignatureClaim, type IAirdropSignatureData, type IAirdropSignatureIdentity, type IClaimSignature, type IContractConfig, type IExtraData, type IProject, type IProjectExtra, type ISignatureClaimData, type IWalletClient, type Identity, AirdropService$1 as SolanaAirdropService, SignatureAirdropService$1 as SolanaSignatureAirdropService, SplTokenVersion, SignatureAirdropService as SuiSignatureAirdropService, type SupportedChainType, SupportedChains, type ThemeConfig, AirdropService as TonAirdropService, TonAirdropVersionEnum, TonWalletService, ZERO_ADDRESS, apiClient, batchCheckClaimedForSignature, bindWallet, checkEligibility, checkGetSignatures, cleanUrlParams, clusterApiUrl, connectDiscordApi, connectGoogleApi, connectTwitter, delay, disconnectRecipient, fetchTokenVersion, flipAddressType, getAirdropContractConfig, getAirdropPro, getAirdropProject, getAirdropProjectId, getAirdropQuery, getAvailableClaimAmountForSignature, getChainById, getChainConfig, getChainRpc, getCustomNaNoId, getJettonInfo, getOrCreateAssociatedTokenAccount, getTonProjectIdByAddress, hexStrToU8Array, isBeforeByUnix, isGreaterThan, isMobile, mevmDevNet, retry, safeParseJSON, safePlus, signBrBTestnet, solanaDevNet, solanaMainNet, suiMainNet, suiTestNet, tonMainNet, tonTestNet };
|
package/dist/index.d.ts
CHANGED
|
@@ -1388,6 +1388,7 @@ declare const SupportedChains: ({
|
|
|
1388
1388
|
declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
1389
1389
|
declare const CONST: {
|
|
1390
1390
|
readonly TWITTER_AUTH_SUCCESS: "twitter:auth:success";
|
|
1391
|
+
readonly DISCORD_AUTH_SUCCESS: "discord:auth:success";
|
|
1391
1392
|
readonly GOOGLE_AUTH_SUCCESS: "google:auth:success";
|
|
1392
1393
|
readonly WELCOME_SIGNATURE_STATEMENT: "Welcome to TokenTable!";
|
|
1393
1394
|
};
|
|
@@ -1846,7 +1847,8 @@ declare enum AirdropSigIdentityTypeEnum {
|
|
|
1846
1847
|
SolanaWallet = "Solana Wallet",
|
|
1847
1848
|
EVMWallet = "EVM Wallet",
|
|
1848
1849
|
TONWallet = "TON Wallet",
|
|
1849
|
-
Google = "Google Account"
|
|
1850
|
+
Google = "Google Account",
|
|
1851
|
+
Discord = "Discord Account"
|
|
1850
1852
|
}
|
|
1851
1853
|
interface IProjectExtra {
|
|
1852
1854
|
kyc: boolean;
|
|
@@ -2094,6 +2096,7 @@ interface WalletBindParams {
|
|
|
2094
2096
|
}
|
|
2095
2097
|
declare const connectTwitter: (data: SocialConnectParams, baseURL?: string) => Promise<SidResponse>;
|
|
2096
2098
|
declare const connectGoogleApi: (data: SocialConnectParams, baseURL?: string) => Promise<SidResponse>;
|
|
2099
|
+
declare const connectDiscordApi: (data: SocialConnectParams, baseURL?: string) => Promise<SidResponse>;
|
|
2097
2100
|
declare const checkEligibility: (data: {
|
|
2098
2101
|
projectId: string;
|
|
2099
2102
|
}, baseURL?: string) => Promise<IAirdropSignatureData>;
|
|
@@ -2191,4 +2194,4 @@ declare const getAvailableClaimAmountForSignature: ({ contractAddress, chainId,
|
|
|
2191
2194
|
}[];
|
|
2192
2195
|
}) => Promise<string | 0>;
|
|
2193
2196
|
|
|
2194
|
-
export { AirdropSigIdentityTypeEnum, ApiClient, type ApiClientOptions, type ApiRequestOptions, CONST, ChainConfig, type ChainId, ChainType, ETokenType, ErrorCode, AirdropService$2 as EvmAirdropService, EvmAirdropVersionEnum, type EvmContractClientOption, SignatureAirdropService$2 as EvmSignatureAirdropService, type FetchTokenMetadataOptions, type FetchTokenVersionOptions, type IAirdropClaim, type IAirdropClaimData, type IAirdropData, type IAirdropOptions, type IAirdropService, type IAirdropSignatureClaim, type IAirdropSignatureData, type IAirdropSignatureIdentity, type IClaimSignature, type IContractConfig, type IExtraData, type IProject, type IProjectExtra, type ISignatureClaimData, type IWalletClient, type Identity, AirdropService$1 as SolanaAirdropService, SignatureAirdropService$1 as SolanaSignatureAirdropService, SplTokenVersion, SignatureAirdropService as SuiSignatureAirdropService, type SupportedChainType, SupportedChains, type ThemeConfig, AirdropService as TonAirdropService, TonAirdropVersionEnum, TonWalletService, ZERO_ADDRESS, apiClient, batchCheckClaimedForSignature, bindWallet, checkEligibility, checkGetSignatures, cleanUrlParams, clusterApiUrl, connectGoogleApi, connectTwitter, delay, disconnectRecipient, fetchTokenVersion, flipAddressType, getAirdropContractConfig, getAirdropPro, getAirdropProject, getAirdropProjectId, getAirdropQuery, getAvailableClaimAmountForSignature, getChainById, getChainConfig, getChainRpc, getCustomNaNoId, getJettonInfo, getOrCreateAssociatedTokenAccount, getTonProjectIdByAddress, hexStrToU8Array, isBeforeByUnix, isGreaterThan, isMobile, mevmDevNet, retry, safeParseJSON, safePlus, signBrBTestnet, solanaDevNet, solanaMainNet, suiMainNet, suiTestNet, tonMainNet, tonTestNet };
|
|
2197
|
+
export { AirdropSigIdentityTypeEnum, ApiClient, type ApiClientOptions, type ApiRequestOptions, CONST, ChainConfig, type ChainId, ChainType, ETokenType, ErrorCode, AirdropService$2 as EvmAirdropService, EvmAirdropVersionEnum, type EvmContractClientOption, SignatureAirdropService$2 as EvmSignatureAirdropService, type FetchTokenMetadataOptions, type FetchTokenVersionOptions, type IAirdropClaim, type IAirdropClaimData, type IAirdropData, type IAirdropOptions, type IAirdropService, type IAirdropSignatureClaim, type IAirdropSignatureData, type IAirdropSignatureIdentity, type IClaimSignature, type IContractConfig, type IExtraData, type IProject, type IProjectExtra, type ISignatureClaimData, type IWalletClient, type Identity, AirdropService$1 as SolanaAirdropService, SignatureAirdropService$1 as SolanaSignatureAirdropService, SplTokenVersion, SignatureAirdropService as SuiSignatureAirdropService, type SupportedChainType, SupportedChains, type ThemeConfig, AirdropService as TonAirdropService, TonAirdropVersionEnum, TonWalletService, ZERO_ADDRESS, apiClient, batchCheckClaimedForSignature, bindWallet, checkEligibility, checkGetSignatures, cleanUrlParams, clusterApiUrl, connectDiscordApi, connectGoogleApi, connectTwitter, delay, disconnectRecipient, fetchTokenVersion, flipAddressType, getAirdropContractConfig, getAirdropPro, getAirdropProject, getAirdropProjectId, getAirdropQuery, getAvailableClaimAmountForSignature, getChainById, getChainConfig, getChainRpc, getCustomNaNoId, getJettonInfo, getOrCreateAssociatedTokenAccount, getTonProjectIdByAddress, hexStrToU8Array, isBeforeByUnix, isGreaterThan, isMobile, mevmDevNet, retry, safeParseJSON, safePlus, signBrBTestnet, solanaDevNet, solanaMainNet, suiMainNet, suiTestNet, tonMainNet, tonTestNet };
|
package/dist/index.js
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
checkGetSignatures: () => checkGetSignatures,
|
|
57
57
|
cleanUrlParams: () => cleanUrlParams,
|
|
58
58
|
clusterApiUrl: () => clusterApiUrl,
|
|
59
|
+
connectDiscordApi: () => connectDiscordApi,
|
|
59
60
|
connectGoogleApi: () => connectGoogleApi,
|
|
60
61
|
connectTwitter: () => connectTwitter,
|
|
61
62
|
delay: () => delay,
|
|
@@ -382,11 +383,11 @@ var ChainConfig = {
|
|
|
382
383
|
rpcUrl: solanaMainNet.rpcUrls.default.http[0]
|
|
383
384
|
},
|
|
384
385
|
[suiTestNet.id]: {
|
|
385
|
-
contractAddress: "
|
|
386
|
+
contractAddress: "0xeb9691cd945745a89fd497746d30fb1a1e936865c6c514817d913fadef66df44",
|
|
386
387
|
rpcUrl: suiTestNet.rpcUrls.default.http[0]
|
|
387
388
|
},
|
|
388
389
|
[suiMainNet.id]: {
|
|
389
|
-
contractAddress: "",
|
|
390
|
+
contractAddress: "0x3f73ec78d3e8a99277496edb6183d6075490983c2a29542a1c3f709aa31169b5",
|
|
390
391
|
rpcUrl: suiMainNet.rpcUrls.default.http[0]
|
|
391
392
|
}
|
|
392
393
|
};
|
|
@@ -413,6 +414,7 @@ var SupportedChains = [
|
|
|
413
414
|
var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
414
415
|
var CONST = {
|
|
415
416
|
TWITTER_AUTH_SUCCESS: "twitter:auth:success",
|
|
417
|
+
DISCORD_AUTH_SUCCESS: "discord:auth:success",
|
|
416
418
|
GOOGLE_AUTH_SUCCESS: "google:auth:success",
|
|
417
419
|
WELCOME_SIGNATURE_STATEMENT: "Welcome to TokenTable!"
|
|
418
420
|
};
|
|
@@ -3806,6 +3808,7 @@ var AirdropSigIdentityTypeEnum = /* @__PURE__ */ ((AirdropSigIdentityTypeEnum2)
|
|
|
3806
3808
|
AirdropSigIdentityTypeEnum2["EVMWallet"] = "EVM Wallet";
|
|
3807
3809
|
AirdropSigIdentityTypeEnum2["TONWallet"] = "TON Wallet";
|
|
3808
3810
|
AirdropSigIdentityTypeEnum2["Google"] = "Google Account";
|
|
3811
|
+
AirdropSigIdentityTypeEnum2["Discord"] = "Discord Account";
|
|
3809
3812
|
return AirdropSigIdentityTypeEnum2;
|
|
3810
3813
|
})(AirdropSigIdentityTypeEnum || {});
|
|
3811
3814
|
var ETokenType = /* @__PURE__ */ ((ETokenType2) => {
|
|
@@ -10598,6 +10601,12 @@ var connectGoogleApi = async (data, baseURL) => {
|
|
|
10598
10601
|
headers: getSidHeader(data.projectId)
|
|
10599
10602
|
});
|
|
10600
10603
|
};
|
|
10604
|
+
var connectDiscordApi = async (data, baseURL) => {
|
|
10605
|
+
const client = createApiClient(baseURL);
|
|
10606
|
+
return client.post("/airdrop-open/connect-discord", data, {
|
|
10607
|
+
headers: getSidHeader(data.projectId)
|
|
10608
|
+
});
|
|
10609
|
+
};
|
|
10601
10610
|
var checkEligibility = async (data, baseURL) => {
|
|
10602
10611
|
const headers = getSidHeader(data.projectId);
|
|
10603
10612
|
if (!headers.sid)
|
|
@@ -12476,7 +12485,6 @@ var SuiBaseDistributorClient = class extends SuiContractClientBase {
|
|
|
12476
12485
|
arguments: [tx.pure(projectIdBytes), tx.object(projectRegistryId)]
|
|
12477
12486
|
});
|
|
12478
12487
|
const result = await this.signAndExecute(tx);
|
|
12479
|
-
console.log(result, "res");
|
|
12480
12488
|
let distributorId;
|
|
12481
12489
|
if (result.effects?.created) {
|
|
12482
12490
|
const createdObj = result.effects.created.find(
|
|
@@ -12517,7 +12525,6 @@ var SuiBaseDistributorClient = class extends SuiContractClientBase {
|
|
|
12517
12525
|
return this.signAndExecute(tx);
|
|
12518
12526
|
}
|
|
12519
12527
|
async getDistributorInfo() {
|
|
12520
|
-
console.log(this.client, this.distributorId, "distributorId");
|
|
12521
12528
|
const res = await this.client.getObject({
|
|
12522
12529
|
id: this.distributorId,
|
|
12523
12530
|
options: { showContent: true }
|
|
@@ -12556,7 +12563,6 @@ var SuiBaseDistributorClient = class extends SuiContractClientBase {
|
|
|
12556
12563
|
[coinType],
|
|
12557
12564
|
[this.distributorId, claimIdsBytes]
|
|
12558
12565
|
);
|
|
12559
|
-
console.log(res, "claims");
|
|
12560
12566
|
const [data, type] = res;
|
|
12561
12567
|
if (type === "vector<bool>" && data) {
|
|
12562
12568
|
const uint8Array = new Uint8Array(data);
|
|
@@ -12570,7 +12576,6 @@ var SuiBaseDistributorClient = class extends SuiContractClientBase {
|
|
|
12570
12576
|
[],
|
|
12571
12577
|
[projectRegistryId, Array.from(Buffer.from(projectId, "utf8"))]
|
|
12572
12578
|
);
|
|
12573
|
-
console.log(distributorId, "id");
|
|
12574
12579
|
return distributorId.Some;
|
|
12575
12580
|
}
|
|
12576
12581
|
async getOwnerCapId() {
|
|
@@ -12580,7 +12585,6 @@ var SuiBaseDistributorClient = class extends SuiContractClientBase {
|
|
|
12580
12585
|
StructType: `${this.packageId}::ownable::OwnerCap`
|
|
12581
12586
|
}
|
|
12582
12587
|
});
|
|
12583
|
-
console.log(objects, "objects");
|
|
12584
12588
|
const ownerCapId = objects.data[0]?.data?.objectId;
|
|
12585
12589
|
return ownerCapId;
|
|
12586
12590
|
}
|
|
@@ -12610,7 +12614,6 @@ var SuiDistributorWithFeeClient = class extends SuiContractClientBase {
|
|
|
12610
12614
|
throw new Error(`Insufficient balance. Required: ${totalFeesStr}, Available coins: ${coins.data.length}`);
|
|
12611
12615
|
}
|
|
12612
12616
|
async claimWithFee(coinType, feeCollector, data) {
|
|
12613
|
-
console.log(data, feeCollector, this.distributorId, "data");
|
|
12614
12617
|
const recipients = data.map((item) => item.recipient);
|
|
12615
12618
|
const claimIds = data.map((item) => item.claimId);
|
|
12616
12619
|
const signatures = data.map((item) => item.signature);
|
|
@@ -12738,6 +12741,7 @@ var SignatureAirdropService3 = class {
|
|
|
12738
12741
|
checkGetSignatures,
|
|
12739
12742
|
cleanUrlParams,
|
|
12740
12743
|
clusterApiUrl,
|
|
12744
|
+
connectDiscordApi,
|
|
12741
12745
|
connectGoogleApi,
|
|
12742
12746
|
connectTwitter,
|
|
12743
12747
|
delay,
|