@rozoai/intent-pay 0.1.21-beta.7 → 0.1.21-beta.9

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.
Files changed (31) hide show
  1. package/build/hooks/useDaimoPay.d.ts +1 -1
  2. package/build/package.json.js +4 -4
  3. package/build/provider/DaimoPayProvider.d.ts +1 -1
  4. package/build/provider/StellarContextProvider.d.ts +9 -6
  5. package/build/src/components/DaimoPayButton/index.js +7 -2
  6. package/build/src/components/DaimoPayButton/index.js.map +1 -1
  7. package/build/src/components/Pages/Confirmation/index.js +2 -2
  8. package/build/src/components/Pages/Confirmation/index.js.map +1 -1
  9. package/build/src/components/Pages/Solana/PayWithSolanaToken/index.js +2 -2
  10. package/build/src/components/Pages/Solana/PayWithSolanaToken/index.js.map +1 -1
  11. package/build/src/components/Pages/Stellar/ConnectStellar/index.js +7 -12
  12. package/build/src/components/Pages/Stellar/ConnectStellar/index.js.map +1 -1
  13. package/build/src/components/Pages/Stellar/PayWithStellarToken/index.js +6 -5
  14. package/build/src/components/Pages/Stellar/PayWithStellarToken/index.js.map +1 -1
  15. package/build/src/components/Pages/WaitingDepositAddress/index.js +1 -1
  16. package/build/src/components/Pages/WaitingDepositAddress/index.js.map +1 -1
  17. package/build/src/hooks/useDaimoPay.js +3 -2
  18. package/build/src/hooks/useDaimoPay.js.map +1 -1
  19. package/build/src/hooks/usePaymentState.js +2 -2
  20. package/build/src/hooks/usePaymentState.js.map +1 -1
  21. package/build/src/provider/DaimoPayProvider.js +1 -1
  22. package/build/src/provider/DaimoPayProvider.js.map +1 -1
  23. package/build/src/provider/StellarContextProvider.js +67 -113
  24. package/build/src/provider/StellarContextProvider.js.map +1 -1
  25. package/build/src/utils/index.js +1 -11
  26. package/build/src/utils/index.js.map +1 -1
  27. package/build/src/utils/stellar/singleton-import.js +34 -79
  28. package/build/src/utils/stellar/singleton-import.js.map +1 -1
  29. package/build/utils/stellar/index.d.ts +2 -3
  30. package/build/utils/stellar/singleton-import.d.ts +9 -9
  31. package/package.json +4 -4
@@ -1,84 +1,39 @@
1
- import '@reown/appkit/networks';
2
- import { WalletConnectModule, WalletConnectAllowedMethods } from './walletconnect.module.js';
3
-
4
1
  /**
5
- * Creates or returns existing StellarWalletsKit instance
6
- * This prevents duplicate custom element registration errors
2
+ * Initialises StellarWalletsKit (v2 static class) exactly once.
3
+ *
4
+ * In v2 the kit is a static singleton by design — there is no instance to
5
+ * store. Calling StellarWalletsKit.init() a second time is a no-op (the kit
6
+ * guards against double-init internally), so this helper is safe to call from
7
+ * multiple places.
7
8
  */
8
- async function getStellarKitInstance(config) {
9
- // Return existing instance if available
10
- if (typeof window !== "undefined" &&
11
- globalThis.__ROZO_STELLAR_KIT_INSTANCE__) {
12
- config?.log?.("[Rozo] Using existing StellarWalletsKit instance");
13
- return globalThis.__ROZO_STELLAR_KIT_INSTANCE__;
14
- }
15
- // If already loading, wait for it
16
- if (typeof window !== "undefined" &&
17
- globalThis.__ROZO_STELLAR_KIT_LOADING__) {
18
- config?.log?.("[Rozo] Waiting for StellarWalletsKit initialization...");
19
- return globalThis.__ROZO_STELLAR_KIT_LOADING__;
20
- }
21
- // Check if custom element is already registered
22
- if (typeof window !== "undefined" &&
23
- customElements.get("stellar-wallets-modal")) {
24
- throw new Error("⚠️ StellarWalletsKit custom element is already registered.\n\n" +
25
- "This usually means the library was initialized elsewhere in your app.\n" +
26
- "To fix this:\n\n" +
27
- "1. Create ONE StellarWalletsKit instance at your app root\n" +
28
- '2. Pass it to RozoPayProvider via the "stellarKit" prop\n\n' +
29
- "Example:\n\n" +
30
- 'import { StellarWalletsKit, WalletNetwork, allowAllModules } from "@creit.tech/stellar-wallets-kit";\n\n' +
31
- "const stellarKit = new StellarWalletsKit({\n" +
32
- " network: WalletNetwork.PUBLIC,\n" +
33
- " modules: allowAllModules(),\n" +
34
- "});\n\n" +
35
- "<RozoPayProvider stellarKit={stellarKit}>\n" +
36
- " {children}\n" +
37
- "</RozoPayProvider>");
38
- }
39
- // Start loading
40
- const loadingPromise = (async () => {
41
- try {
42
- const module = await import('@creit.tech/stellar-wallets-kit');
43
- const { StellarWalletsKit, WalletNetwork, allowAllModules } = module;
44
- const newKit = new StellarWalletsKit({
45
- network: config?.network || WalletNetwork.PUBLIC,
46
- selectedWalletId: config?.selectedWalletId || "freighter",
47
- modules: config?.modules || [
48
- ...allowAllModules(),
49
- new WalletConnectModule({
50
- url: "https://rozo.ai",
51
- projectId: "7440dd8acf85933ffcc775ec6675d4a9",
52
- method: WalletConnectAllowedMethods.SIGN_AND_SUBMIT,
53
- description: `Visa Layer for Stablecoins`,
54
- name: "Rozo",
55
- icons: ["https://rozo.ai/rozo-logo.png"],
56
- network: WalletNetwork.PUBLIC,
57
- }),
58
- ],
59
- });
60
- // Store globally
61
- if (typeof window !== "undefined") {
62
- globalThis.__ROZO_STELLAR_KIT_INSTANCE__ = newKit;
63
- }
64
- config?.log?.("[Rozo] StellarWalletsKit initialized successfully");
65
- return newKit;
66
- }
67
- catch (error) {
68
- config?.log?.(`[Rozo] Failed to initialize StellarWalletsKit: ${error}`);
69
- throw error;
70
- }
71
- finally {
72
- if (typeof window !== "undefined") {
73
- globalThis.__ROZO_STELLAR_KIT_LOADING__ = undefined;
74
- }
75
- }
76
- })();
77
- if (typeof window !== "undefined") {
78
- globalThis.__ROZO_STELLAR_KIT_LOADING__ = loadingPromise;
79
- }
80
- return loadingPromise;
9
+ async function initStellarKit(config) {
10
+ if (typeof window === "undefined")
11
+ return;
12
+ const { StellarWalletsKit } = await import('@creit.tech/stellar-wallets-kit/sdk');
13
+ // Networks lives on the root export, not /sdk
14
+ const { Networks } = await import('@creit.tech/stellar-wallets-kit');
15
+ const { defaultModules } = await import('@creit.tech/stellar-wallets-kit/modules/utils');
16
+ const { WalletConnectModule, WalletConnectTargetChain } = await import('@creit.tech/stellar-wallets-kit/modules/wallet-connect');
17
+ const modules = config?.modules ?? [
18
+ ...defaultModules(),
19
+ new WalletConnectModule({
20
+ projectId: "7440dd8acf85933ffcc775ec6675d4a9",
21
+ metadata: {
22
+ name: "Rozo",
23
+ description: "Visa Layer for Stablecoins",
24
+ icons: ["https://rozo.ai/rozo-logo.png"],
25
+ url: "https://rozo.ai",
26
+ },
27
+ allowedChains: [WalletConnectTargetChain.PUBLIC],
28
+ }),
29
+ ];
30
+ StellarWalletsKit.init({
31
+ network: config?.network ?? Networks.PUBLIC,
32
+ selectedWalletId: config?.selectedWalletId,
33
+ modules,
34
+ });
35
+ config?.log?.("[Rozo] StellarWalletsKit v2 initialised");
81
36
  }
82
37
 
83
- export { getStellarKitInstance };
38
+ export { initStellarKit };
84
39
  //# sourceMappingURL=singleton-import.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"singleton-import.js","sources":["../../../../src/utils/stellar/singleton-import.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AASA;;;AAGG;AACI,eAAe,qBAAqB,CAAC,MAK3C,EAAA;;IAEC,IACE,OAAO,MAAM,KAAK,WAAW;QAC5B,UAAkB,CAAC,6BAA6B,EACjD;AACA,QAAA,MAAM,EAAE,GAAG,GAAG,kDAAkD,CAAC,CAAC;QAClE,OAAQ,UAAkB,CAAC,6BAA6B,CAAC;KAC1D;;IAGD,IACE,OAAO,MAAM,KAAK,WAAW;QAC5B,UAAkB,CAAC,4BAA4B,EAChD;AACA,QAAA,MAAM,EAAE,GAAG,GAAG,wDAAwD,CAAC,CAAC;QACxE,OAAQ,UAAkB,CAAC,4BAA4B,CAAC;KACzD;;IAGD,IACE,OAAO,MAAM,KAAK,WAAW;AAC7B,QAAA,cAAc,CAAC,GAAG,CAAC,uBAAuB,CAAC,EAC3C;QACA,MAAM,IAAI,KAAK,CACb,gEAAgE;YAC9D,yEAAyE;YACzE,kBAAkB;YAClB,6DAA6D;YAC7D,6DAA6D;YAC7D,cAAc;YACd,0GAA0G;YAC1G,8CAA8C;YAC9C,oCAAoC;YACpC,iCAAiC;YACjC,SAAS;YACT,6CAA6C;YAC7C,gBAAgB;AACh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AAkB,CAAC,4BAA4B,GAAG,SAAS,CAAC;aAC9D;SACF;KACF,GAAG,CAAC;AAEL,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AAChC,QAAA,UAAkB,CAAC,4BAA4B,GAAG,cAAc,CAAC;KACnE;AAED,IAAA,OAAO,cAAc,CAAC;AACxB;;;;"}
1
+ {"version":3,"file":"singleton-import.js","sources":["../../../../src/utils/stellar/singleton-import.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;AAOG;AACI,eAAe,cAAc,CAAC,MAQpC,EAAA;IACC,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAE1C,MAAM,EAAE,iBAAiB,EAAE,GACzB,MAAM,OAAO,qCAAqC,CAAC,CAAC;;IAEtD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,OAAO,iCAAiC,CAAC,CAAC;IACrE,MAAM,EAAE,cAAc,EAAE,GACtB,MAAM,OAAO,+CAA+C,CAAC,CAAC;IAChE,MAAM,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,GACrD,MAAM,OAAO,wDAAwD,CAAC,CAAC;AAEzE,IAAA,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,IAAI;AACjC,QAAA,GAAG,cAAc,EAAE;AACnB,QAAA,IAAI,mBAAmB,CAAC;AACtB,YAAA,SAAS,EAAE,kCAAkC;AAC7C,YAAA,QAAQ,EAAE;AACR,gBAAA,IAAI,EAAE,MAAM;AACZ,gBAAA,WAAW,EAAE,4BAA4B;gBACzC,KAAK,EAAE,CAAC,+BAA+B,CAAC;AACxC,gBAAA,GAAG,EAAE,iBAAiB;AACvB,aAAA;AACD,YAAA,aAAa,EAAE,CAAC,wBAAwB,CAAC,MAAM,CAAC;SACjD,CAAC;KACH,CAAC;IAEF,iBAAiB,CAAC,IAAI,CAAC;AACrB,QAAA,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,QAAQ,CAAC,MAAM;QAC3C,gBAAgB,EAAE,MAAM,EAAE,gBAAgB;QAC1C,OAAO;AACR,KAAA,CAAC,CAAC;AAEH,IAAA,MAAM,EAAE,GAAG,GAAG,yCAAyC,CAAC,CAAC;AAC3D;;;;"}
@@ -1,6 +1,5 @@
1
1
  export * from "./types";
2
- export * from "./walletconnect.module";
3
2
  export { defineStellarChain, isStellarChain, STELLAR_NETWORKS } from "./types";
4
3
  export type { StellarChainConfig } from "./types";
5
- export { WalletConnectAllowedMethods, WalletConnectModule, WalletConnectTargetChain, } from "./walletconnect.module";
6
- export type { IParsedWalletConnectSession, IWalletConnectConstructorParams, } from "./walletconnect.module";
4
+ export { WalletConnectModule, WalletConnectTargetChain, } from "@creit.tech/stellar-wallets-kit/modules/wallet-connect";
5
+ export type { TWalletConnectModuleParams } from "@creit.tech/stellar-wallets-kit/modules/wallet-connect";
@@ -1,15 +1,15 @@
1
- import type { StellarWalletsKit } from "@creit.tech/stellar-wallets-kit";
2
- declare global {
3
- let __ROZO_STELLAR_KIT_INSTANCE__: StellarWalletsKit | undefined;
4
- let __ROZO_STELLAR_KIT_LOADING__: Promise<StellarWalletsKit> | undefined;
5
- }
6
1
  /**
7
- * Creates or returns existing StellarWalletsKit instance
8
- * This prevents duplicate custom element registration errors
2
+ * Initialises StellarWalletsKit (v2 static class) exactly once.
3
+ *
4
+ * In v2 the kit is a static singleton by design — there is no instance to
5
+ * store. Calling StellarWalletsKit.init() a second time is a no-op (the kit
6
+ * guards against double-init internally), so this helper is safe to call from
7
+ * multiple places.
9
8
  */
10
- export declare function getStellarKitInstance(config?: {
9
+ export declare function initStellarKit(config?: {
11
10
  log?: (msg: string) => void;
11
+ /** Pass a `Networks` enum value from `@creit.tech/stellar-wallets-kit`. Defaults to `Networks.PUBLIC`. */
12
12
  network?: any;
13
13
  selectedWalletId?: string;
14
14
  modules?: any[];
15
- }): Promise<StellarWalletsKit>;
15
+ }): Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rozoai/intent-pay",
3
3
  "private": false,
4
- "version": "0.1.21-beta.7",
4
+ "version": "0.1.21-beta.9",
5
5
  "author": "RozoAI",
6
6
  "homepage": "https://github.com/RozoAI/intent-pay",
7
7
  "license": "BSD-2-Clause",
@@ -39,7 +39,7 @@
39
39
  "@reown/appkit": "^1.7.0",
40
40
  "@rollup/plugin-image": "^3.0.3",
41
41
  "@rollup/plugin-typescript": "^12.1.2",
42
- "@rozoai/intent-common": "0.1.14-beta.2",
42
+ "@rozoai/intent-common": "0.1.14-beta.3",
43
43
  "@solana/spl-token": "^0.4.14",
44
44
  "@solana/wallet-adapter-base": "^0.9.27",
45
45
  "@solana/wallet-adapter-react": "^0.15.39",
@@ -60,8 +60,8 @@
60
60
  "styled-components": "^5.3.5"
61
61
  },
62
62
  "peerDependencies": {
63
- "@creit.tech/stellar-wallets-kit": "^1.9.5",
64
- "@stellar/stellar-sdk": "^14.2.0",
63
+ "@creit.tech/stellar-wallets-kit": "^2.2.0",
64
+ "@stellar/stellar-sdk": "^15.1.0",
65
65
  "@tanstack/react-query": ">=5.0.0",
66
66
  "react": "18.x || 19.x",
67
67
  "react-dom": "18.x || 19.x",