@primuslabs/fund-js-sdk 0.1.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/README.md +10 -0
- package/dist/index.d.mts +62 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.js +1383 -0
- package/dist/index.mjs +1358 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## Primus Fund SDK
|
|
2
|
+
|
|
3
|
+
The **Primus Fund SDK** provides a straightforward and simple way to send crypto to anyone’s social account, powered by **zkTLS**, to onboard more Web2 users.
|
|
4
|
+
|
|
5
|
+
For details, please refer to the following links:
|
|
6
|
+
|
|
7
|
+
- [Overview](./README/overview.md)
|
|
8
|
+
- [How to intall the SDK](./README/install.md)
|
|
9
|
+
- [Example: Funding Tokens](./README/example.md)
|
|
10
|
+
- [Receiver Guide](./README/receiver-guide.md)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
type AttNetworkRequest = {
|
|
2
|
+
url: string,
|
|
3
|
+
header: string, // json string
|
|
4
|
+
method: string,
|
|
5
|
+
body: string
|
|
6
|
+
}
|
|
7
|
+
type AttNetworkResponseResolve = {
|
|
8
|
+
keyName: string,
|
|
9
|
+
parseType: string, //json or html
|
|
10
|
+
parsePath: string
|
|
11
|
+
}
|
|
12
|
+
type Attestor = {
|
|
13
|
+
attestorAddr: string,
|
|
14
|
+
url: string
|
|
15
|
+
}
|
|
16
|
+
type Attestation = {
|
|
17
|
+
recipient: string,
|
|
18
|
+
request: AttNetworkRequest,
|
|
19
|
+
reponseResolve: AttNetworkResponseResolve[],
|
|
20
|
+
data: string, // json string
|
|
21
|
+
attConditions: string, // json string
|
|
22
|
+
timestamp: number,
|
|
23
|
+
additionParams: string,
|
|
24
|
+
attestors: Attestor[],
|
|
25
|
+
signatures: string[],
|
|
26
|
+
}
|
|
27
|
+
declare global {
|
|
28
|
+
interface Window {
|
|
29
|
+
primus?: any;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// start
|
|
34
|
+
//
|
|
35
|
+
// ERC20_TYPE = 0;
|
|
36
|
+
// NATIVE_TYPE = 1;
|
|
37
|
+
type TokenType = 0 | 1
|
|
38
|
+
type TokenInfo =
|
|
39
|
+
| { tokenType: 0; tokenAddress: string }
|
|
40
|
+
| { tokenType: 1; tokenAddress?: string };
|
|
41
|
+
|
|
42
|
+
type RecipientBaseInfo = {
|
|
43
|
+
socialPlatform: string;// The name of the social platform.
|
|
44
|
+
userIdentifier: string;// The user’s unique identifier on the platforms.
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type RecipientInfo = RecipientBaseInfo & {
|
|
48
|
+
tokenAmount: string;// The amount of the token
|
|
49
|
+
nftIds?: bigint[];// The nft token ids when token is nft.
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type FundParam = {
|
|
53
|
+
tokenInfo: TokenInfo;
|
|
54
|
+
recipientInfos: RecipientInfo[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type ClaimParam = RecipientBaseInfo & {
|
|
58
|
+
attestation: Attestation;
|
|
59
|
+
fundIndex?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type { AttNetworkRequest, AttNetworkResponseResolve, Attestation, Attestor, ClaimParam, FundParam, RecipientBaseInfo, RecipientInfo, TokenInfo, TokenType };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
type AttNetworkRequest = {
|
|
2
|
+
url: string,
|
|
3
|
+
header: string, // json string
|
|
4
|
+
method: string,
|
|
5
|
+
body: string
|
|
6
|
+
}
|
|
7
|
+
type AttNetworkResponseResolve = {
|
|
8
|
+
keyName: string,
|
|
9
|
+
parseType: string, //json or html
|
|
10
|
+
parsePath: string
|
|
11
|
+
}
|
|
12
|
+
type Attestor = {
|
|
13
|
+
attestorAddr: string,
|
|
14
|
+
url: string
|
|
15
|
+
}
|
|
16
|
+
type Attestation = {
|
|
17
|
+
recipient: string,
|
|
18
|
+
request: AttNetworkRequest,
|
|
19
|
+
reponseResolve: AttNetworkResponseResolve[],
|
|
20
|
+
data: string, // json string
|
|
21
|
+
attConditions: string, // json string
|
|
22
|
+
timestamp: number,
|
|
23
|
+
additionParams: string,
|
|
24
|
+
attestors: Attestor[],
|
|
25
|
+
signatures: string[],
|
|
26
|
+
}
|
|
27
|
+
declare global {
|
|
28
|
+
interface Window {
|
|
29
|
+
primus?: any;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// start
|
|
34
|
+
//
|
|
35
|
+
// ERC20_TYPE = 0;
|
|
36
|
+
// NATIVE_TYPE = 1;
|
|
37
|
+
type TokenType = 0 | 1
|
|
38
|
+
type TokenInfo =
|
|
39
|
+
| { tokenType: 0; tokenAddress: string }
|
|
40
|
+
| { tokenType: 1; tokenAddress?: string };
|
|
41
|
+
|
|
42
|
+
type RecipientBaseInfo = {
|
|
43
|
+
socialPlatform: string;// The name of the social platform.
|
|
44
|
+
userIdentifier: string;// The user’s unique identifier on the platforms.
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
type RecipientInfo = RecipientBaseInfo & {
|
|
48
|
+
tokenAmount: string;// The amount of the token
|
|
49
|
+
nftIds?: bigint[];// The nft token ids when token is nft.
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type FundParam = {
|
|
53
|
+
tokenInfo: TokenInfo;
|
|
54
|
+
recipientInfos: RecipientInfo[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type ClaimParam = RecipientBaseInfo & {
|
|
58
|
+
attestation: Attestation;
|
|
59
|
+
fundIndex?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type { AttNetworkRequest, AttNetworkResponseResolve, Attestation, Attestor, ClaimParam, FundParam, RecipientBaseInfo, RecipientInfo, TokenInfo, TokenType };
|