@zing-protocol/zing-sdk 0.1.0 → 0.1.1
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/config/common.d.ts +0 -6
- package/dist/config/common.js +0 -51
- package/dist/config/mainnet.js +12 -38
- package/dist/config/testnet.js +2 -26
- package/dist/config/types.d.ts +1 -6
- package/dist/const.js +1 -1
- package/package.json +1 -1
- package/dist/lib/oauth-pwa.d.ts +0 -11
- package/dist/lib/oauth-pwa.js +0 -55
package/dist/config/common.d.ts
CHANGED
|
@@ -15,9 +15,3 @@ export type ProviderInfo = {
|
|
|
15
15
|
name: string;
|
|
16
16
|
icon: string;
|
|
17
17
|
};
|
|
18
|
-
export declare const PLATFORM_PROVIDER_INFO: Record<PlatformType, ProviderInfo>;
|
|
19
|
-
export declare const PLATFORMS_HOSTNAME: Record<PlatformType, string>;
|
|
20
|
-
export declare const MEMBERSHIP_LEVELS: Record<number, {
|
|
21
|
-
nameKey: string;
|
|
22
|
-
featureKeys: string[];
|
|
23
|
-
}>;
|
package/dist/config/common.js
CHANGED
|
@@ -15,54 +15,3 @@ export const WALRUS_UPLOAD_FLOW_STAGES = [
|
|
|
15
15
|
export const COIN_DECIMALS = {
|
|
16
16
|
USDC: 6,
|
|
17
17
|
};
|
|
18
|
-
export const PLATFORM_PROVIDER_INFO = {
|
|
19
|
-
twitter: {
|
|
20
|
-
name: "Twitter",
|
|
21
|
-
icon: "/icons/twitter.svg",
|
|
22
|
-
providerHash: "0x168c2d4c2c7fd8c0eb21d4cd9aa634a716b61186b1f61e7ab78cd0dbff34fb04",
|
|
23
|
-
},
|
|
24
|
-
// instagram: {
|
|
25
|
-
// name: 'Instagram',
|
|
26
|
-
// icon: 'popup/icons/instagram.svg',
|
|
27
|
-
// providerHash: '',
|
|
28
|
-
// },
|
|
29
|
-
// medium: {
|
|
30
|
-
// name: 'Medium',
|
|
31
|
-
// icon: 'popup/icons/medium.svg',
|
|
32
|
-
// providerHash: '',
|
|
33
|
-
// },
|
|
34
|
-
// substack: {
|
|
35
|
-
// name: 'Substack',
|
|
36
|
-
// icon: 'popup/icons/substack.svg',
|
|
37
|
-
// providerHash: '',
|
|
38
|
-
// },
|
|
39
|
-
};
|
|
40
|
-
export const PLATFORMS_HOSTNAME = {
|
|
41
|
-
twitter: "https://x.com",
|
|
42
|
-
// medium: 'https://medium.com',
|
|
43
|
-
// substack: 'https://substack.com',
|
|
44
|
-
// instagram: 'https://www.instagram.com',
|
|
45
|
-
};
|
|
46
|
-
export const MEMBERSHIP_LEVELS = {
|
|
47
|
-
0: {
|
|
48
|
-
nameKey: "membershipTier.0.name",
|
|
49
|
-
featureKeys: ["membershipTier.0.features.0", "membershipTier.0.features.1"],
|
|
50
|
-
},
|
|
51
|
-
1: {
|
|
52
|
-
nameKey: "membershipTier.1.name",
|
|
53
|
-
featureKeys: [
|
|
54
|
-
"membershipTier.1.features.0",
|
|
55
|
-
"membershipTier.1.features.1",
|
|
56
|
-
"membershipTier.1.features.2",
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
2: {
|
|
60
|
-
nameKey: "membershipTier.2.name",
|
|
61
|
-
featureKeys: [
|
|
62
|
-
"membershipTier.2.features.0",
|
|
63
|
-
"membershipTier.2.features.1",
|
|
64
|
-
"membershipTier.2.features.2",
|
|
65
|
-
"membershipTier.2.features.3",
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
};
|
package/dist/config/mainnet.js
CHANGED
|
@@ -1,53 +1,28 @@
|
|
|
1
1
|
// zing
|
|
2
2
|
export const mainnetZingConfig = {
|
|
3
|
-
ZING_FRAMEWORK_PACKAGE_ADDRESS: "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
ZING_STUDIO_V0_PACKAGE_ADDRESS: "0xf245105e9896942a02614e4dbbb6c6636452879d58b1e12db1e0364c0d1532a7",
|
|
3
|
+
ZING_FRAMEWORK_PACKAGE_ADDRESS: "0x176ca50788521662366802f5847edd1e41abb2532cc65d4d69b583a47f5444cd",
|
|
4
|
+
ZING_STUDIO_PACKAGE_ADDRESS: "0x6ee54cd57f6f30a70cffeccb16251fc59be211a9706d7c8f0ea8e08c22aaf667",
|
|
5
|
+
ZING_STUDIO_V0_PACKAGE_ADDRESS: "0x6ee54cd57f6f30a70cffeccb16251fc59be211a9706d7c8f0ea8e08c22aaf667",
|
|
7
6
|
ZING_TREASURY_SHARED_OBJECT_REF: {
|
|
8
|
-
objectId: "
|
|
9
|
-
initialSharedVersion:
|
|
7
|
+
objectId: "0x1536fde075b1ad16b4ed52c41518e792af25813ab9eb9f234af926a700a3c4a8",
|
|
8
|
+
initialSharedVersion: 798329790,
|
|
10
9
|
mutable: true,
|
|
11
10
|
},
|
|
12
|
-
ZING_IDENTITY_CONFIG_SHARED_OBJECT_REF: {
|
|
13
|
-
objectId: "0xd511beaa68a5647cdc193b753f3658e8e33bc87ec603857c3d6d315562f0e470",
|
|
14
|
-
initialSharedVersion: 661729843,
|
|
15
|
-
mutable: true,
|
|
16
|
-
},
|
|
17
|
-
PROOF_COMMITMENT_TYPE: "0xd666d3234eb46551273014f5616ed2575e709a861dd3812613d59104a4cb7344::reclaim::ProofCommitment",
|
|
18
|
-
IDENTITY_PLATFORMS: {
|
|
19
|
-
twitter: {
|
|
20
|
-
PLATFORM_UPDATE_PROOF_TARGET: "0x910fd7e88647ea9369ab269fa5629f0efd815dfa5a7b7ef2355ffee13852413b::twitter::update_with_twitter_proof",
|
|
21
|
-
PLATFORM_TYPE: "0x910fd7e88647ea9369ab269fa5629f0efd815dfa5a7b7ef2355ffee13852413b::twitter::Twitter",
|
|
22
|
-
RECLAIM_MANAGER_SHARED_OBJECT_REF: {
|
|
23
|
-
objectId: "0xe8849f48412d3b7220902fd56b7f128f324ffb27615bf57e83c638f523aa10e6",
|
|
24
|
-
initialSharedVersion: 662715429,
|
|
25
|
-
mutable: true,
|
|
26
|
-
},
|
|
27
|
-
IDENTITY_MANAGER_SHARED_OBJECT_REF: {
|
|
28
|
-
objectId: "0xff54f2a3bfc4daedbbc7ecbb1b0985e8311c95fd847f070825882e7e083af5f1",
|
|
29
|
-
initialSharedVersion: 662715429,
|
|
30
|
-
mutable: true,
|
|
31
|
-
},
|
|
32
|
-
IDENTITY_MANAGER_IDENTIFIER_INFO_DF_ID: "0xcbe996d13835c0fcc9a0a015098546997ae9ff58dd075389bfe764d43bb46c2e",
|
|
33
|
-
IDENTITY_MANAGER_ADDRESS_TO_IDENTIFIER_DF_ID: "0x20ba08956972f73a956b288dde1659f9ad6059256205beb20bc3fa2cc0377ac2",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
11
|
ZING_STUDIO_CONFIG_SHARED_OBJECT_REF: {
|
|
37
|
-
objectId: "
|
|
38
|
-
initialSharedVersion:
|
|
12
|
+
objectId: "0x69d470648e17e28489e50e27deb1bb78141dfd68ac68b433632d2499efa72477",
|
|
13
|
+
initialSharedVersion: 798329791,
|
|
39
14
|
mutable: true,
|
|
40
15
|
},
|
|
41
16
|
ZING_STORAGE_TREASURY_SHARED_OBJECT_REF: {
|
|
42
|
-
objectId: "
|
|
43
|
-
initialSharedVersion:
|
|
17
|
+
objectId: "0xb0b272378f226b61b22f4f9fd7c496d9acc9ddc14b70339e100b2811143fdcfe",
|
|
18
|
+
initialSharedVersion: 798329791,
|
|
44
19
|
mutable: true,
|
|
45
20
|
},
|
|
46
21
|
ZING_WORKS_TYPE: {
|
|
47
|
-
article: "
|
|
22
|
+
article: "0x6ee54cd57f6f30a70cffeccb16251fc59be211a9706d7c8f0ea8e08c22aaf667::article::Article",
|
|
48
23
|
},
|
|
49
24
|
EVENT_TYPES: {
|
|
50
|
-
publishArticleEvent: "
|
|
25
|
+
publishArticleEvent: "0x6ee54cd57f6f30a70cffeccb16251fc59be211a9706d7c8f0ea8e08c22aaf667::article::PublishArticle",
|
|
51
26
|
},
|
|
52
27
|
};
|
|
53
28
|
// walrus
|
|
@@ -60,14 +35,13 @@ export const mainnetWalrusConfig = {
|
|
|
60
35
|
mutable: true, // mutable when register_blob
|
|
61
36
|
},
|
|
62
37
|
WALRUS_AGGREGATORS: ["https://aggregator.suicore.com"],
|
|
63
|
-
WALRUS_UPLOAD_RELAY_BASE_URL: "https://walrus-upload-relay-production-73a4.up.railway.app",
|
|
64
38
|
EVENT_TYPES: {
|
|
65
39
|
blobRegistered: "0xfdc88f7d7cf30afab2f82e8380d11ee8f70efb90e863d1de8616fae1bb09ea77::events::BlobRegistered",
|
|
66
40
|
},
|
|
67
41
|
};
|
|
68
42
|
// coins
|
|
69
43
|
export const mainnetCoinConfig = {
|
|
70
|
-
USDC: "
|
|
44
|
+
USDC: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
71
45
|
};
|
|
72
46
|
// seal
|
|
73
47
|
export const mainnetSealConfig = {
|
package/dist/config/testnet.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const testnetZingConfig = {
|
|
2
2
|
ZING_FRAMEWORK_PACKAGE_ADDRESS: "0xd851eb5b907b60aa5fd958dd74044d809c49ee60001cad621726f03ea138f943",
|
|
3
|
-
ZING_IDENTITY_PACKAGE_ADDRESS:
|
|
3
|
+
// ZING_IDENTITY_PACKAGE_ADDRESS:
|
|
4
|
+
// "0xaaf27a90890ac1efface4fbb22597e95829cbe6cbb771df02f0d2cc93f067c70",
|
|
4
5
|
ZING_STUDIO_PACKAGE_ADDRESS: "0x200e858488929b31f7dbfa87ea85a1ada811945f33fb00aefe600762855507db",
|
|
5
6
|
ZING_STUDIO_V0_PACKAGE_ADDRESS: "0x3502955f106ee334653443005b37ebc6d1ddf7b9c704d39090263ae136ba599d",
|
|
6
7
|
ZING_TREASURY_SHARED_OBJECT_REF: {
|
|
@@ -8,30 +9,6 @@ export const testnetZingConfig = {
|
|
|
8
9
|
initialSharedVersion: 645292716,
|
|
9
10
|
mutable: true,
|
|
10
11
|
},
|
|
11
|
-
ZING_IDENTITY_CONFIG_SHARED_OBJECT_REF: {
|
|
12
|
-
objectId: "0xde2eb80aa01db47e65b705c80af931ccb1d56a8a6a06403e205fa8fb1ad4a02e",
|
|
13
|
-
initialSharedVersion: 645292717,
|
|
14
|
-
mutable: false,
|
|
15
|
-
},
|
|
16
|
-
PROOF_COMMITMENT_TYPE: "0xaaf27a90890ac1efface4fbb22597e95829cbe6cbb771df02f0d2cc93f067c70::reclaim::ProofCommitment",
|
|
17
|
-
IDENTITY_PLATFORMS: {
|
|
18
|
-
twitter: {
|
|
19
|
-
PLATFORM_UPDATE_PROOF_TARGET: "0xa0d84dc088ba37e3108e69458c4dc0d0f836479f384fbe1fe98c737d27945c3e::twitter::update_with_twitter_proof",
|
|
20
|
-
PLATFORM_TYPE: "0xa0d84dc088ba37e3108e69458c4dc0d0f836479f384fbe1fe98c737d27945c3e::twitter::Twitter",
|
|
21
|
-
RECLAIM_MANAGER_SHARED_OBJECT_REF: {
|
|
22
|
-
objectId: "0x3d3c56359728f12f8b54e9e2f5d5861a168f7d75675b83afc7f8b9cce289bfc1",
|
|
23
|
-
initialSharedVersion: 663897156,
|
|
24
|
-
mutable: true,
|
|
25
|
-
},
|
|
26
|
-
IDENTITY_MANAGER_SHARED_OBJECT_REF: {
|
|
27
|
-
objectId: "0x44e9171b465f9bbad19864c06cec7ad24d3e830198fe10d9acc84f4e31ad59f6",
|
|
28
|
-
initialSharedVersion: 663897156,
|
|
29
|
-
mutable: true,
|
|
30
|
-
},
|
|
31
|
-
IDENTITY_MANAGER_IDENTIFIER_INFO_DF_ID: "0x69ff6f5d7e4a64d177c24ae9882e732402065eb9668f41f9337b56fea39bd46d",
|
|
32
|
-
IDENTITY_MANAGER_ADDRESS_TO_IDENTIFIER_DF_ID: "0x1073c13dfed532938cd978adfcb0b14a165350762392e0bb3137f493112d0520",
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
12
|
// Studio
|
|
36
13
|
ZING_STUDIO_CONFIG_SHARED_OBJECT_REF: {
|
|
37
14
|
objectId: "0x0fff74127495094c4f8b0736a0bf4a0c8612e0a8c37342495d8aa00073d25c1e",
|
|
@@ -59,7 +36,6 @@ export const testnetWalrusConfig = {
|
|
|
59
36
|
mutable: true, // mutable when register_blob
|
|
60
37
|
},
|
|
61
38
|
WALRUS_AGGREGATORS: ["https://aggregator.suicore.com"],
|
|
62
|
-
WALRUS_UPLOAD_RELAY_BASE_URL: "https://walrus-upload-relay-production-73a4.up.railway.app",
|
|
63
39
|
EVENT_TYPES: {
|
|
64
40
|
blobRegistered: "0xd84704c17fc870b8764832c535aa6b11f21a95cd6f5bb38a9b07d2cf42220c66::events::BlobRegistered",
|
|
65
41
|
},
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CoinSymbol,
|
|
1
|
+
import type { CoinSymbol, WorkType } from "./common.js";
|
|
2
2
|
import type { KeyServerConfig } from "@mysten/seal";
|
|
3
3
|
import type { WalrusClient } from "@mysten/walrus";
|
|
4
4
|
export interface SharedObjectRef {
|
|
@@ -16,13 +16,9 @@ export interface PlatformConfig {
|
|
|
16
16
|
}
|
|
17
17
|
export interface ZingConfig {
|
|
18
18
|
ZING_FRAMEWORK_PACKAGE_ADDRESS: string;
|
|
19
|
-
ZING_IDENTITY_PACKAGE_ADDRESS: string;
|
|
20
19
|
ZING_STUDIO_PACKAGE_ADDRESS: string;
|
|
21
20
|
ZING_STUDIO_V0_PACKAGE_ADDRESS: string;
|
|
22
21
|
ZING_TREASURY_SHARED_OBJECT_REF: SharedObjectRef;
|
|
23
|
-
ZING_IDENTITY_CONFIG_SHARED_OBJECT_REF: SharedObjectRef;
|
|
24
|
-
PROOF_COMMITMENT_TYPE: string;
|
|
25
|
-
IDENTITY_PLATFORMS: Record<PlatformType, PlatformConfig>;
|
|
26
22
|
ZING_STUDIO_CONFIG_SHARED_OBJECT_REF: SharedObjectRef;
|
|
27
23
|
ZING_STORAGE_TREASURY_SHARED_OBJECT_REF: SharedObjectRef;
|
|
28
24
|
ZING_WORKS_TYPE: Record<WorkType, string>;
|
|
@@ -33,7 +29,6 @@ export interface WalrusConfig {
|
|
|
33
29
|
WAL_STAKING_INNER_FIELD: string;
|
|
34
30
|
WALRUS_SYSTEM_SHARED_OBJECT_REF: SharedObjectRef;
|
|
35
31
|
WALRUS_AGGREGATORS: string[];
|
|
36
|
-
WALRUS_UPLOAD_RELAY_BASE_URL: string;
|
|
37
32
|
EVENT_TYPES: Record<"blobRegistered", string>;
|
|
38
33
|
}
|
|
39
34
|
export interface SealConfig {
|
package/dist/const.js
CHANGED
|
@@ -8,7 +8,7 @@ export const WALRUS_UPLOAD_RELAY_BASE_URL = {
|
|
|
8
8
|
export const SEAL_SERVERS_CONFIGS = {
|
|
9
9
|
mainnet: [
|
|
10
10
|
{
|
|
11
|
-
objectId: "
|
|
11
|
+
objectId: "0x145540d931f182fef76467dd8074c9839aea126852d90d18e1556fcbbd1208b6",
|
|
12
12
|
weight: 1,
|
|
13
13
|
},
|
|
14
14
|
],
|
package/package.json
CHANGED
package/dist/lib/oauth-pwa.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface OAuthState {
|
|
2
|
-
ephemeralSecretKey: string;
|
|
3
|
-
maxEpoch: number;
|
|
4
|
-
randomness: string;
|
|
5
|
-
authProvider: string;
|
|
6
|
-
timestamp: number;
|
|
7
|
-
}
|
|
8
|
-
export declare function isIOSPWA(): boolean;
|
|
9
|
-
export declare function saveOAuthState(state: OAuthState): void;
|
|
10
|
-
export declare function getOAuthState(): OAuthState | null;
|
|
11
|
-
export declare function clearOAuthState(): void;
|
package/dist/lib/oauth-pwa.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Storage keys for OAuth state
|
|
2
|
-
const OAUTH_STATE_KEY = "zing:oauth:state";
|
|
3
|
-
// Helper to detect iOS (Safari or PWA) where popups are unreliable
|
|
4
|
-
export function isIOSPWA() {
|
|
5
|
-
// Check if it's iOS device
|
|
6
|
-
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
7
|
-
if (!isIOS)
|
|
8
|
-
return false;
|
|
9
|
-
// In iOS, we should use redirect for:
|
|
10
|
-
// 1. PWA/Standalone mode (home screen apps)
|
|
11
|
-
// 2. Regular Safari (popups are blocked by default)
|
|
12
|
-
const isStandalone = window.navigator.standalone === true;
|
|
13
|
-
const isSafari = /Safari/.test(navigator.userAgent) &&
|
|
14
|
-
!/CriOS|FxiOS|EdgiOS/.test(navigator.userAgent);
|
|
15
|
-
// Use redirect-based flow for iOS Safari or standalone mode
|
|
16
|
-
return isStandalone || isSafari;
|
|
17
|
-
}
|
|
18
|
-
export function saveOAuthState(state) {
|
|
19
|
-
try {
|
|
20
|
-
localStorage.setItem(OAUTH_STATE_KEY, JSON.stringify(state));
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
console.error("Failed to save OAuth state:", error);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export function getOAuthState() {
|
|
27
|
-
try {
|
|
28
|
-
const data = localStorage.getItem(OAUTH_STATE_KEY);
|
|
29
|
-
if (!data) {
|
|
30
|
-
console.error("No OAuth state found in localStorage");
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
const state = JSON.parse(data);
|
|
34
|
-
// Check if state is not too old (5 minutes max)
|
|
35
|
-
const now = Date.now();
|
|
36
|
-
if (now - state.timestamp > 5 * 60 * 1000) {
|
|
37
|
-
console.error("OAuth state expired");
|
|
38
|
-
clearOAuthState();
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return state;
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
console.error("Failed to get OAuth state:", error);
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export function clearOAuthState() {
|
|
49
|
-
try {
|
|
50
|
-
localStorage.removeItem(OAUTH_STATE_KEY);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
console.error("Failed to clear OAuth state:", error);
|
|
54
|
-
}
|
|
55
|
-
}
|