@zing-protocol/zing-sdk 0.1.0 → 0.1.2

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.
@@ -4,7 +4,7 @@ export declare const PLATFORMS: readonly ["twitter"];
4
4
  export type PlatformType = (typeof PLATFORMS)[number];
5
5
  export declare const WORKS: readonly ["article"];
6
6
  export type WorkType = (typeof WORKS)[number];
7
- export declare const COIN_SYMBOLS: readonly ["USDC"];
7
+ export declare const COIN_SYMBOLS: readonly ["USDC", "WAL"];
8
8
  export type CoinSymbol = (typeof COIN_SYMBOLS)[number];
9
9
  export declare const AUTH_PROVIDER_ICON_PATH: Record<AuthProvider, string>;
10
10
  export declare const WALRUS_UPLOAD_FLOW_STAGES: readonly ["encode", "register_blob", "upload", "certify_blob", "publish"];
@@ -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
- }>;
@@ -1,7 +1,7 @@
1
1
  export const AUTH_PROVIDDERS = ["Google"];
2
2
  export const PLATFORMS = ["twitter"];
3
3
  export const WORKS = ["article"];
4
- export const COIN_SYMBOLS = ["USDC"];
4
+ export const COIN_SYMBOLS = ["USDC", "WAL"];
5
5
  export const AUTH_PROVIDER_ICON_PATH = {
6
6
  Google: "icons/google.svg",
7
7
  };
@@ -14,55 +14,5 @@ export const WALRUS_UPLOAD_FLOW_STAGES = [
14
14
  ];
15
15
  export const COIN_DECIMALS = {
16
16
  USDC: 6,
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
- },
17
+ WAL: 9,
68
18
  };
@@ -1,53 +1,28 @@
1
1
  // zing
2
2
  export const mainnetZingConfig = {
3
- ZING_FRAMEWORK_PACKAGE_ADDRESS: "0x58c2589e21157bac347513cb4c392ffa34af0e1a630f5a77c0ee92f141057d01",
4
- ZING_IDENTITY_PACKAGE_ADDRESS: "0x4a22da297adc51ec5ed6e1f4fc884a45a50d8299b8c3deb9d056392210ce951d",
5
- ZING_STUDIO_PACKAGE_ADDRESS: "0x3db3853f032b5b403e35a7d863fb630359c5bec238990f52a8c33c6ac1f5222f",
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: "0x30f0dc6c1ad6bdf944ed303e9c966af60a3bbbef1b5b9ae3f23de1d44b02f5b6",
9
- initialSharedVersion: 661729837,
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: "0x9fe332fc68cb2a736a9643dc4f06089c7c4894396db0fb47895d216599ee5c00",
38
- initialSharedVersion: 663114127,
12
+ objectId: "0x69d470648e17e28489e50e27deb1bb78141dfd68ac68b433632d2499efa72477",
13
+ initialSharedVersion: 798329791,
39
14
  mutable: true,
40
15
  },
41
16
  ZING_STORAGE_TREASURY_SHARED_OBJECT_REF: {
42
- objectId: "0xd80e520d304a43b21c3d2dba2c89463819c2ef9b779c89d15e19b425b385fe74",
43
- initialSharedVersion: 663114127,
17
+ objectId: "0xb0b272378f226b61b22f4f9fd7c496d9acc9ddc14b70339e100b2811143fdcfe",
18
+ initialSharedVersion: 798329791,
44
19
  mutable: true,
45
20
  },
46
21
  ZING_WORKS_TYPE: {
47
- article: "0xf245105e9896942a02614e4dbbb6c6636452879d58b1e12db1e0364c0d1532a7::article::Article",
22
+ article: "0x6ee54cd57f6f30a70cffeccb16251fc59be211a9706d7c8f0ea8e08c22aaf667::article::Article",
48
23
  },
49
24
  EVENT_TYPES: {
50
- publishArticleEvent: "0xf245105e9896942a02614e4dbbb6c6636452879d58b1e12db1e0364c0d1532a7::article::PublishArticle",
25
+ publishArticleEvent: "0x6ee54cd57f6f30a70cffeccb16251fc59be211a9706d7c8f0ea8e08c22aaf667::article::PublishArticle",
51
26
  },
52
27
  };
53
28
  // walrus
@@ -60,14 +35,14 @@ 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: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC",
44
+ USDC: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
45
+ WAL: "0x356a26eb9e012a68958082340d4c4116e7f55615cf27affcff209cf0ae544f59::wal::WAL",
71
46
  };
72
47
  // seal
73
48
  export const mainnetSealConfig = {
@@ -1,6 +1,7 @@
1
1
  export const testnetZingConfig = {
2
2
  ZING_FRAMEWORK_PACKAGE_ADDRESS: "0xd851eb5b907b60aa5fd958dd74044d809c49ee60001cad621726f03ea138f943",
3
- ZING_IDENTITY_PACKAGE_ADDRESS: "0xaaf27a90890ac1efface4fbb22597e95829cbe6cbb771df02f0d2cc93f067c70",
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
  },
@@ -67,6 +43,7 @@ export const testnetWalrusConfig = {
67
43
  // coins
68
44
  export const testnetCoinConfig = {
69
45
  USDC: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC",
46
+ WAL: "0x8270feb7375eee355e64fdb69c50abb6b5f9393a722883c1cf45f8e26048810a::wal::WAL",
70
47
  };
71
48
  export const testnetSealConfig = {
72
49
  serverConfigs: [
@@ -1,4 +1,4 @@
1
- import type { CoinSymbol, PlatformType, WorkType } from "./common.js";
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.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import type { SuiNetwork } from "./types.js";
2
2
  import type { KeyServerConfig } from "@mysten/seal";
3
- export declare const WALRUS_UPLOAD_RELAY_BASE_URL: Record<SuiNetwork, string>;
4
3
  export declare const SEAL_SERVERS_CONFIGS: Record<SuiNetwork, KeyServerConfig[]>;
package/dist/const.js CHANGED
@@ -1,14 +1,7 @@
1
- // // Walrus upload relay
2
- export const WALRUS_UPLOAD_RELAY_BASE_URL = {
3
- mainnet: "https://walrus-upload-relay-production-73a4.up.railway.app",
4
- testnet: "https://walrus-upload-relay-production-73a4.up.railway.app",
5
- };
6
- // Platform
7
- // seal
8
1
  export const SEAL_SERVERS_CONFIGS = {
9
2
  mainnet: [
10
3
  {
11
- objectId: "0xe0eb52eba9261b96e895bbb4deca10dcd64fbc626a1133017adcd5131353fd10",
4
+ objectId: "0x145540d931f182fef76467dd8074c9839aea126852d90d18e1556fcbbd1208b6",
12
5
  weight: 1,
13
6
  },
14
7
  ],
@@ -12,7 +12,6 @@ export function useZingInfiniteQuery(input, options = {}, memo = []) {
12
12
  const methodMap = zingInfiniteQueryMethodMap(zingClient);
13
13
  const { method, params, limit = 20 } = input;
14
14
  return useInfiniteQuery({
15
- // eslint-disable-next-line @tanstack/query/exhaustive-deps
16
15
  queryKey: [zingClient.network, method, memo],
17
16
  queryFn: async ({ pageParam }) => {
18
17
  const fn = methodMap[method];
@@ -19,7 +19,6 @@ export function useZingQueries(options) {
19
19
  const queryConfigs = options.queries.map((queryConfig) => {
20
20
  const { method, params, ...queryOptions } = queryConfig;
21
21
  return {
22
- // eslint-disable-next-line @tanstack/query/exhaustive-deps
23
22
  queryKey: [zingClient.network, method, params],
24
23
  queryFn: async () => {
25
24
  const fn = methodMap[method];
@@ -20,7 +20,6 @@ export function useZingQuery(input, options = {}, memo = []) {
20
20
  const methodMap = zingQueryMethodMap(zingClient);
21
21
  const { method, params } = input;
22
22
  return useQuery({
23
- // eslint-disable-next-line @tanstack/query/exhaustive-deps
24
23
  queryKey: [zingClient.network, method, memo],
25
24
  gcTime: options.gcTime,
26
25
  staleTime: options.staleTime,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@zing-protocol/zing-sdk",
3
3
  "sideEffects": false,
4
4
  "type": "module",
5
- "version": "0.1.0",
5
+ "version": "0.1.2",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "scripts": {
15
15
  "build": "tsc",
16
- "type-check": "tsc --noEmit"
16
+ "lint": "eslint ."
17
17
  },
18
18
  "dependencies": {
19
19
  "@mysten/seal": "^1.0.1",
@@ -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;
@@ -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
- }