@gurge/sdk 0.3.39 → 0.3.41
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/common/src/webworker/package.json +19 -17
- package/common/src/webworker/viteWorkerURL.constant.cjs +4 -4
- package/common/src/webworker/viteWorkerURL.constant.mjs +4 -4
- package/index.cjs +1 -1
- package/index.d.ts +0 -1
- package/index.mjs +1 -2
- package/package.json +19 -17
- package/react-native/HinkalProvider.cjs +1 -1
- package/react-native/HinkalWebViewWorker.cjs +2 -2
- package/react-native/HinkalWebViewWorker.mjs +16 -16
- package/react-native/index.cjs +1 -0
- package/react-native/index.d.ts +1 -0
- package/react-native/index.mjs +10 -0
- package/react-native/metro-config.js +1 -25
- package/react-native/shims/crypto.js +1 -2
- package/react-native/shims/globals.js +15 -0
- package/react-native/shims.d.ts +16 -0
- package/sdk/package.json.cjs +1 -1
- package/sdk/package.json.mjs +16 -18
- package/react-native/setup.cjs +0 -1
- package/react-native/setup.d.ts +0 -0
- package/react-native/setup.mjs +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gurge/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.41",
|
|
4
4
|
"homepage": "hinkal.io",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hinkal Protocol"
|
|
@@ -14,11 +14,7 @@
|
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
16
|
"types": "./index.d.ts",
|
|
17
|
-
"react-native":
|
|
18
|
-
"types": "./index.d.ts",
|
|
19
|
-
"import": "./index.mjs",
|
|
20
|
-
"default": "./index.cjs"
|
|
21
|
-
},
|
|
17
|
+
"react-native": "./index.cjs",
|
|
22
18
|
"import": "./index.mjs",
|
|
23
19
|
"default": "./index.cjs"
|
|
24
20
|
},
|
|
@@ -70,13 +66,14 @@
|
|
|
70
66
|
"import": "./providers/prepareSolanaHinkal.mjs",
|
|
71
67
|
"default": "./providers/prepareSolanaHinkal.cjs"
|
|
72
68
|
},
|
|
73
|
-
"./react-native
|
|
74
|
-
"types": "./react-native/
|
|
75
|
-
"react-native": "./react-native/
|
|
76
|
-
"import": "./react-native/
|
|
77
|
-
"default": "./react-native/
|
|
69
|
+
"./react-native": {
|
|
70
|
+
"types": "./react-native/index.d.ts",
|
|
71
|
+
"react-native": "./react-native/index.cjs",
|
|
72
|
+
"import": "./react-native/index.mjs",
|
|
73
|
+
"default": "./react-native/index.cjs"
|
|
78
74
|
},
|
|
79
|
-
"./react-native/metro-config": "./react-native/metro-config.js"
|
|
75
|
+
"./react-native/metro-config": "./react-native/metro-config.js",
|
|
76
|
+
"./react-native/shims/*": "./react-native/shims/*"
|
|
80
77
|
},
|
|
81
78
|
"types": "./index.d.ts",
|
|
82
79
|
"scripts": {
|
|
@@ -114,14 +111,13 @@
|
|
|
114
111
|
"uuid": "^9.0.1",
|
|
115
112
|
"node-forge": "^1.3.1",
|
|
116
113
|
"poseidon-lite": "^0.3.0",
|
|
117
|
-
"tronweb": "^6.2.0"
|
|
118
|
-
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
119
|
-
"assert": "^2.1.0",
|
|
120
|
-
"react-native-get-random-values": "^1.11.0"
|
|
114
|
+
"tronweb": "^6.2.0"
|
|
121
115
|
},
|
|
122
116
|
"peerDependencies": {
|
|
123
117
|
"wagmi": "2.13.3",
|
|
124
|
-
"@walletconnect/utils": "^2.17.2"
|
|
118
|
+
"@walletconnect/utils": "^2.17.2",
|
|
119
|
+
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
120
|
+
"react-native-get-random-values": "^1.11.0"
|
|
125
121
|
},
|
|
126
122
|
"peerDependenciesMeta": {
|
|
127
123
|
"wagmi": {
|
|
@@ -129,6 +125,12 @@
|
|
|
129
125
|
},
|
|
130
126
|
"@walletconnect/utils": {
|
|
131
127
|
"optional": true
|
|
128
|
+
},
|
|
129
|
+
"@react-native-async-storage/async-storage": {
|
|
130
|
+
"optional": true
|
|
131
|
+
},
|
|
132
|
+
"react-native-get-random-values": {
|
|
133
|
+
"optional": true
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
136
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
const domain = 'https://
|
|
2
|
+
const domain = 'https://storage.googleapis.com/hinkal-workers-staging';
|
|
3
3
|
|
|
4
4
|
// Returns a blob:// URL which points
|
|
5
5
|
// to a javascript file which will call
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
var e = /* @__PURE__ */ ((r) => (r.ZKProof = "ZKProof", r.SnarkJS = "SnarkJS", r.UTXO = "UTXO", r))(e || {});
|
|
15
15
|
|
|
16
16
|
const n = async () => ({
|
|
17
|
-
[e.ZKProof]: await getWorkerURL(domain + '/0.3.
|
|
18
|
-
[e.SnarkJS]: await getWorkerURL(domain + '/0.3.
|
|
19
|
-
[e.UTXO]: await getWorkerURL(domain + '/0.3.
|
|
17
|
+
[e.ZKProof]: await getWorkerURL(domain + '/0.3.41/' + 'zkProofWorkerLauncher.js'),
|
|
18
|
+
[e.SnarkJS]: await getWorkerURL(domain + '/0.3.41/' + 'snarkjsWorkerLauncher.js'),
|
|
19
|
+
[e.UTXO]: await getWorkerURL(domain + '/0.3.41/' + 'utxoWorkerLauncher.js'),
|
|
20
20
|
});
|
|
21
21
|
exports.getWorkerViteURL = n;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
const domain = 'https://
|
|
2
|
+
const domain = 'https://storage.googleapis.com/hinkal-workers-staging';
|
|
3
3
|
|
|
4
4
|
// Returns a blob:// URL which points
|
|
5
5
|
// to a javascript file which will call
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
var e = /* @__PURE__ */ ((r) => (r.ZKProof = "ZKProof", r.SnarkJS = "SnarkJS", r.UTXO = "UTXO", r))(e || {});
|
|
15
15
|
|
|
16
16
|
const n = async () => ({
|
|
17
|
-
[e.ZKProof]: await getWorkerURL(domain + '/0.3.
|
|
18
|
-
[e.SnarkJS]: await getWorkerURL(domain + '/0.3.
|
|
19
|
-
[e.UTXO]: await getWorkerURL(domain + '/0.3.
|
|
17
|
+
[e.ZKProof]: await getWorkerURL(domain + '/0.3.41/' + 'zkProofWorkerLauncher.js'),
|
|
18
|
+
[e.SnarkJS]: await getWorkerURL(domain + '/0.3.41/' + 'snarkjsWorkerLauncher.js'),
|
|
19
|
+
[e.UTXO]: await getWorkerURL(domain + '/0.3.41/' + 'utxoWorkerLauncher.js'),
|
|
20
20
|
});
|
|
21
21
|
export { n as getWorkerViteURL };
|
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./common/src/types/external-action.types.cjs`),t=require(`./common/src/types/balances.types.cjs`),n=require(`./common/src/functions/pre-transaction/getFeeStructure.cjs`),r=require(`./common/src/crypto/preProcessing.cjs`),i=require(`./services/Hinkal.cjs`);require(`./services/index.cjs`);const a=require(`./functions/utils/refreshBalance.cjs`),o=require(`./functions/integrations/swapApi.cjs`);require(`./functions/index.cjs`),require(`./types/index.cjs`)
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./common/src/types/external-action.types.cjs`),t=require(`./common/src/types/balances.types.cjs`),n=require(`./common/src/functions/pre-transaction/getFeeStructure.cjs`),r=require(`./common/src/crypto/preProcessing.cjs`),i=require(`./services/Hinkal.cjs`);require(`./services/index.cjs`);const a=require(`./functions/utils/refreshBalance.cjs`),o=require(`./functions/integrations/swapApi.cjs`);require(`./functions/index.cjs`),require(`./types/index.cjs`),exports.ExternalActionId=e.ExternalActionId,exports.Hinkal=i.Hinkal,exports.PrivateBalanceUpdateType=t.PrivateBalanceUpdateType,exports.getEvmSwapPrices=o.getEvmSwapPrices,exports.getFeeStructure=n.getFeeStructure,exports.getSolanaSwapPrices=o.getSolanaSwapPrices,exports.preProcessing=r.preProcessing,exports.refreshBalance=a.refreshBalance;
|
package/index.d.ts
CHANGED
package/index.mjs
CHANGED
|
@@ -8,5 +8,4 @@ import { refreshBalance as a } from "./functions/utils/refreshBalance.mjs";
|
|
|
8
8
|
import { getEvmSwapPrices as o, getSolanaSwapPrices as s } from "./functions/integrations/swapApi.mjs";
|
|
9
9
|
import "./functions/index.mjs";
|
|
10
10
|
import "./types/index.mjs";
|
|
11
|
-
|
|
12
|
-
export { e as ExternalActionId, i as Hinkal, c as HinkalProvider, t as PrivateBalanceUpdateType, o as getEvmSwapPrices, n as getFeeStructure, s as getSolanaSwapPrices, r as preProcessing, a as refreshBalance };
|
|
11
|
+
export { e as ExternalActionId, i as Hinkal, t as PrivateBalanceUpdateType, o as getEvmSwapPrices, n as getFeeStructure, s as getSolanaSwapPrices, r as preProcessing, a as refreshBalance };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gurge/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.41",
|
|
4
4
|
"homepage": "hinkal.io",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Hinkal Protocol"
|
|
@@ -14,11 +14,7 @@
|
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
16
|
"types": "./index.d.ts",
|
|
17
|
-
"react-native":
|
|
18
|
-
"types": "./index.d.ts",
|
|
19
|
-
"import": "./index.mjs",
|
|
20
|
-
"default": "./index.cjs"
|
|
21
|
-
},
|
|
17
|
+
"react-native": "./index.cjs",
|
|
22
18
|
"import": "./index.mjs",
|
|
23
19
|
"default": "./index.cjs"
|
|
24
20
|
},
|
|
@@ -70,13 +66,14 @@
|
|
|
70
66
|
"import": "./providers/prepareSolanaHinkal.mjs",
|
|
71
67
|
"default": "./providers/prepareSolanaHinkal.cjs"
|
|
72
68
|
},
|
|
73
|
-
"./react-native
|
|
74
|
-
"types": "./react-native/
|
|
75
|
-
"react-native": "./react-native/
|
|
76
|
-
"import": "./react-native/
|
|
77
|
-
"default": "./react-native/
|
|
69
|
+
"./react-native": {
|
|
70
|
+
"types": "./react-native/index.d.ts",
|
|
71
|
+
"react-native": "./react-native/index.cjs",
|
|
72
|
+
"import": "./react-native/index.mjs",
|
|
73
|
+
"default": "./react-native/index.cjs"
|
|
78
74
|
},
|
|
79
|
-
"./react-native/metro-config": "./react-native/metro-config.js"
|
|
75
|
+
"./react-native/metro-config": "./react-native/metro-config.js",
|
|
76
|
+
"./react-native/shims/*": "./react-native/shims/*"
|
|
80
77
|
},
|
|
81
78
|
"types": "./index.d.ts",
|
|
82
79
|
"scripts": {
|
|
@@ -114,14 +111,13 @@
|
|
|
114
111
|
"uuid": "^9.0.1",
|
|
115
112
|
"node-forge": "^1.3.1",
|
|
116
113
|
"poseidon-lite": "^0.3.0",
|
|
117
|
-
"tronweb": "^6.2.0"
|
|
118
|
-
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
119
|
-
"assert": "^2.1.0",
|
|
120
|
-
"react-native-get-random-values": "^1.11.0"
|
|
114
|
+
"tronweb": "^6.2.0"
|
|
121
115
|
},
|
|
122
116
|
"peerDependencies": {
|
|
123
117
|
"wagmi": "2.13.3",
|
|
124
|
-
"@walletconnect/utils": "^2.17.2"
|
|
118
|
+
"@walletconnect/utils": "^2.17.2",
|
|
119
|
+
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
120
|
+
"react-native-get-random-values": "^1.11.0"
|
|
125
121
|
},
|
|
126
122
|
"peerDependenciesMeta": {
|
|
127
123
|
"wagmi": {
|
|
@@ -129,6 +125,12 @@
|
|
|
129
125
|
},
|
|
130
126
|
"@walletconnect/utils": {
|
|
131
127
|
"optional": true
|
|
128
|
+
},
|
|
129
|
+
"@react-native-async-storage/async-storage": {
|
|
130
|
+
"optional": true
|
|
131
|
+
},
|
|
132
|
+
"react-native-get-random-values": {
|
|
133
|
+
"optional": true
|
|
132
134
|
}
|
|
133
135
|
}
|
|
134
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./HinkalWebViewWorker.cjs`);let t=require(`react/jsx-runtime`);var n=({children:n})=>(0,t.jsxs)(t.Fragment,{children:[n,(0,t.jsx)(e
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./HinkalWebViewWorker.cjs`);let t=require(`react/jsx-runtime`);var n=({children:n})=>(0,t.jsxs)(t.Fragment,{children:[n,(0,t.jsx)(e,{})]});exports.HinkalProvider=n;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../common/src/webworker/workerFactory.cjs`),t=require(`./workerCDNUrls.cjs`),n=require(`./bridge/serialization.utils.cjs`),r=require(`./bridge/HinkalRNWorker.cjs`);let i=require(`react`),a=require(`react
|
|
1
|
+
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../common/src/webworker/workerFactory.cjs`),t=require(`./workerCDNUrls.cjs`),n=require(`./bridge/serialization.utils.cjs`),r=require(`./bridge/HinkalRNWorker.cjs`);let i=require(`react-native`),a=require(`react`),o=require(`react-native-webview`),s=require(`react/jsx-runtime`);var c=`${new URL(Object.values(t.WORKER_CDN_URLS)[0]).origin}/`;e.WorkerFactory.rnWorkerFactory=e=>new r.HinkalRNWorker(e);var l=`
|
|
2
2
|
if (!window.__hinkalPageBoot) (function(){
|
|
3
3
|
window.__hinkalPageBoot = true;
|
|
4
4
|
var URLS = ${JSON.stringify(t.WORKER_CDN_URLS)};
|
|
@@ -95,4 +95,4 @@ if (!window.__hinkalPageBoot) (function(){
|
|
|
95
95
|
|
|
96
96
|
post({ type: 'READY' });
|
|
97
97
|
})();
|
|
98
|
-
true;`,u=`<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script>${l}<\/script></body></html>`,d=
|
|
98
|
+
true;`,u=`<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script>${l}<\/script></body></html>`,d=i.StyleSheet.create({hiddenHost:{position:`absolute`,height:1,width:1,left:-9999,top:-9999,opacity:0}}),f=()=>{let e=(0,a.useRef)(null),t=(0,a.useRef)({ready:!1,queue:[]}),r=(0,a.useCallback)((t,r,a)=>{let o;try{o=JSON.stringify({requestId:t,variant:r,message:a},n.bigIntReplacer)}catch(e){i.DeviceEventEmitter.emit(`FROM_WEBVIEW_WORKER`,{requestId:t,type:`ERROR`,error:`serialize failed: ${e?.message??e}`});return}e.current?.injectJavaScript(`window.handleMessage && window.handleMessage(${o}); true;`)},[]);(0,a.useEffect)(()=>{let e=i.DeviceEventEmitter.addListener(`TO_WEBVIEW_WORKER`,e=>{let n={requestId:e?.__requestId??``,variant:e?.variant??``,message:e?.message};t.current.ready?r(n.requestId,n.variant,n.message):t.current.queue.push(n)});return()=>e.remove()},[r]);let f=(0,a.useCallback)(e=>{let a;try{a=n.reviveBigInts(JSON.parse(e.nativeEvent.data))}catch(e){i.DeviceEventEmitter.emit(`FROM_WEBVIEW_WORKER`,{type:`ERROR`,error:e?.message??`parse error`});return}if(a?.type===`READY`){t.current.ready=!0;let e=t.current.queue;t.current.queue=[],e.forEach(({requestId:e,variant:t,message:n})=>r(e,t,n));return}i.DeviceEventEmitter.emit(`FROM_WEBVIEW_WORKER`,a)},[r]);return(0,s.jsx)(i.View,{pointerEvents:`none`,style:d.hiddenHost,children:(0,s.jsx)(o.WebView,{ref:e,source:{html:u,baseUrl:c},originWhitelist:[`*`],javaScriptEnabled:!0,domStorageEnabled:!0,androidLayerType:`hardware`,onMessage:f,onLoad:()=>e.current?.injectJavaScript(l)})})};module.exports=f;
|
|
@@ -2,8 +2,8 @@ import { WorkerFactory as e } from "../common/src/webworker/workerFactory.mjs";
|
|
|
2
2
|
import { WORKER_CDN_URLS as t } from "./workerCDNUrls.mjs";
|
|
3
3
|
import { bigIntReplacer as n, reviveBigInts as r } from "./bridge/serialization.utils.mjs";
|
|
4
4
|
import { HinkalRNWorker as i } from "./bridge/HinkalRNWorker.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { DeviceEventEmitter as a, StyleSheet as o, View as s } from "react-native";
|
|
6
|
+
import { useCallback as c, useEffect as l, useRef as u } from "react";
|
|
7
7
|
import { WebView as d } from "react-native-webview";
|
|
8
8
|
import { jsx as f } from "react/jsx-runtime";
|
|
9
9
|
//#region libs/shared/sdk/src/react-native/HinkalWebViewWorker.tsx
|
|
@@ -93,7 +93,7 @@ if (!window.__hinkalPageBoot) (function(){
|
|
|
93
93
|
|
|
94
94
|
post({ type: 'READY' });
|
|
95
95
|
})();
|
|
96
|
-
true;`, h = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script>${m}<\/script></body></html>`, g =
|
|
96
|
+
true;`, h = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script>${m}<\/script></body></html>`, g = o.create({ hiddenHost: {
|
|
97
97
|
position: "absolute",
|
|
98
98
|
height: 1,
|
|
99
99
|
width: 1,
|
|
@@ -101,29 +101,29 @@ true;`, h = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><scr
|
|
|
101
101
|
top: -9999,
|
|
102
102
|
opacity: 0
|
|
103
103
|
} }), _ = () => {
|
|
104
|
-
let e =
|
|
104
|
+
let e = u(null), t = u({
|
|
105
105
|
ready: !1,
|
|
106
106
|
queue: []
|
|
107
|
-
}), i =
|
|
108
|
-
let
|
|
107
|
+
}), i = c((t, r, i) => {
|
|
108
|
+
let o;
|
|
109
109
|
try {
|
|
110
|
-
|
|
110
|
+
o = JSON.stringify({
|
|
111
111
|
requestId: t,
|
|
112
112
|
variant: r,
|
|
113
113
|
message: i
|
|
114
114
|
}, n);
|
|
115
115
|
} catch (e) {
|
|
116
|
-
|
|
116
|
+
a.emit("FROM_WEBVIEW_WORKER", {
|
|
117
117
|
requestId: t,
|
|
118
118
|
type: "ERROR",
|
|
119
119
|
error: `serialize failed: ${e?.message ?? e}`
|
|
120
120
|
});
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
|
-
e.current?.injectJavaScript(`window.handleMessage && window.handleMessage(${
|
|
123
|
+
e.current?.injectJavaScript(`window.handleMessage && window.handleMessage(${o}); true;`);
|
|
124
124
|
}, []);
|
|
125
|
-
|
|
126
|
-
let e =
|
|
125
|
+
l(() => {
|
|
126
|
+
let e = a.addListener("TO_WEBVIEW_WORKER", (e) => {
|
|
127
127
|
let n = {
|
|
128
128
|
requestId: e?.__requestId ?? "",
|
|
129
129
|
variant: e?.variant ?? "",
|
|
@@ -133,12 +133,12 @@ true;`, h = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><scr
|
|
|
133
133
|
});
|
|
134
134
|
return () => e.remove();
|
|
135
135
|
}, [i]);
|
|
136
|
-
let
|
|
136
|
+
let o = c((e) => {
|
|
137
137
|
let n;
|
|
138
138
|
try {
|
|
139
139
|
n = r(JSON.parse(e.nativeEvent.data));
|
|
140
140
|
} catch (e) {
|
|
141
|
-
|
|
141
|
+
a.emit("FROM_WEBVIEW_WORKER", {
|
|
142
142
|
type: "ERROR",
|
|
143
143
|
error: e?.message ?? "parse error"
|
|
144
144
|
});
|
|
@@ -150,9 +150,9 @@ true;`, h = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><scr
|
|
|
150
150
|
t.current.queue = [], e.forEach(({ requestId: e, variant: t, message: n }) => i(e, t, n));
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
|
-
|
|
153
|
+
a.emit("FROM_WEBVIEW_WORKER", n);
|
|
154
154
|
}, [i]);
|
|
155
|
-
return /* @__PURE__ */ f(
|
|
155
|
+
return /* @__PURE__ */ f(s, {
|
|
156
156
|
pointerEvents: "none",
|
|
157
157
|
style: g.hiddenHost,
|
|
158
158
|
children: /* @__PURE__ */ f(d, {
|
|
@@ -165,7 +165,7 @@ true;`, h = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><scr
|
|
|
165
165
|
javaScriptEnabled: !0,
|
|
166
166
|
domStorageEnabled: !0,
|
|
167
167
|
androidLayerType: "hardware",
|
|
168
|
-
onMessage:
|
|
168
|
+
onMessage: o,
|
|
169
169
|
onLoad: () => e.current?.injectJavaScript(m)
|
|
170
170
|
})
|
|
171
171
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./HinkalProvider.cjs`);let n=require(`buffer`);require(`react-native-get-random-values`);let r=require(`react-native`);r=e.__toESM(r),global.Buffer=n.Buffer,globalThis.indexedDB===void 0&&(globalThis.indexedDB={}),global.require===void 0&&(global.require=e=>{if(e===`react-native`)return r;throw Error(`global.require shim: unsupported module "${e}"`)}),exports.HinkalProvider=t.HinkalProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HinkalProvider } from './HinkalProvider';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HinkalProvider as e } from "./HinkalProvider.mjs";
|
|
2
|
+
import { Buffer as t } from "buffer";
|
|
3
|
+
import "react-native-get-random-values";
|
|
4
|
+
import * as n from "react-native";
|
|
5
|
+
global.Buffer = t, globalThis.indexedDB === void 0 && (globalThis.indexedDB = {}), global.require === void 0 && (global.require = (e) => {
|
|
6
|
+
if (e === "react-native") return n;
|
|
7
|
+
throw Error(`global.require shim: unsupported module "${e}"`);
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as HinkalProvider };
|
|
@@ -8,29 +8,16 @@
|
|
|
8
8
|
*
|
|
9
9
|
* const config = getDefaultConfig(__dirname);
|
|
10
10
|
* module.exports = applyHinkalMetroConfig(config);
|
|
11
|
-
*
|
|
12
|
-
* Wrap your app with `HinkalProvider` from `@hinkal/sdk`.
|
|
13
11
|
*/
|
|
14
12
|
const path = require('path');
|
|
15
13
|
|
|
16
14
|
const shimDir = path.join(__dirname, 'shims');
|
|
17
|
-
|
|
18
|
-
const resolveSetupModule = () => {
|
|
19
|
-
try {
|
|
20
|
-
return require.resolve('@hinkal/sdk/react-native/setup');
|
|
21
|
-
} catch {
|
|
22
|
-
return path.join(__dirname, 'setup.cjs');
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const setupModule = resolveSetupModule();
|
|
27
15
|
const shim = (name) => ({
|
|
28
16
|
filePath: path.join(shimDir, `${name}.js`),
|
|
29
17
|
type: 'sourceFile',
|
|
30
18
|
});
|
|
31
19
|
|
|
32
|
-
const isFromHinkalSdk = (originPath) =>
|
|
33
|
-
!!originPath && (originPath.includes('/@hinkal/sdk/') || originPath.includes('/@gurge/sdk/'));
|
|
20
|
+
const isFromHinkalSdk = (originPath) => !!originPath && originPath.includes('/@hinkal/sdk/');
|
|
34
21
|
|
|
35
22
|
const applyHinkalMetroConfig = (config) => {
|
|
36
23
|
if (!config || !config.resolver) {
|
|
@@ -52,7 +39,6 @@ const applyHinkalMetroConfig = (config) => {
|
|
|
52
39
|
constants: path.join(shimDir, 'constants.js'),
|
|
53
40
|
'web-worker': path.join(shimDir, 'web-worker.js'),
|
|
54
41
|
url: path.join(shimDir, 'url.js'),
|
|
55
|
-
assert: require.resolve('assert/'),
|
|
56
42
|
};
|
|
57
43
|
|
|
58
44
|
const prevGetTransformOptions = config.transformer && config.transformer.getTransformOptions;
|
|
@@ -80,7 +66,6 @@ const applyHinkalMetroConfig = (config) => {
|
|
|
80
66
|
if (moduleName === 'circomlibjs') return shim('circomlibjs');
|
|
81
67
|
if (moduleName === 'circomlibjs-hinkal-fork') return shim('circomlibjs-hinkal-fork');
|
|
82
68
|
if (moduleName === 'idb-keyval') return shim('idb-keyval');
|
|
83
|
-
if (moduleName === 'assert') return { filePath: require.resolve('assert/'), type: 'sourceFile' };
|
|
84
69
|
|
|
85
70
|
if (isFromHinkalSdk(context.originModulePath)) {
|
|
86
71
|
if (moduleName === 'multiformats' || moduleName.startsWith('multiformats/')) return shim('multiformats');
|
|
@@ -97,15 +82,6 @@ const applyHinkalMetroConfig = (config) => {
|
|
|
97
82
|
return context.resolveRequest(context, moduleName, platform);
|
|
98
83
|
};
|
|
99
84
|
|
|
100
|
-
const upstreamGetModulesRunBeforeMainModule = config.serializer?.getModulesRunBeforeMainModule;
|
|
101
|
-
config.serializer = {
|
|
102
|
-
...(config.serializer ?? {}),
|
|
103
|
-
getModulesRunBeforeMainModule: () => [
|
|
104
|
-
...(upstreamGetModulesRunBeforeMainModule?.() ?? []),
|
|
105
|
-
setupModule,
|
|
106
|
-
],
|
|
107
|
-
};
|
|
108
|
-
|
|
109
85
|
return config;
|
|
110
86
|
};
|
|
111
87
|
|
|
@@ -7,8 +7,7 @@ function ensureRng() {
|
|
|
7
7
|
if (!global.crypto || typeof global.crypto.getRandomValues !== "function") {
|
|
8
8
|
throw new Error(
|
|
9
9
|
"[hinkal-rn] global.crypto.getRandomValues is not available. " +
|
|
10
|
-
"Import
|
|
11
|
-
"before any other module.",
|
|
10
|
+
"Import @hinkal/sdk/react-native (HinkalProvider) before other SDK code.",
|
|
12
11
|
);
|
|
13
12
|
}
|
|
14
13
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
import * as ReactNative from "react-native";
|
|
3
|
+
global.Buffer = Buffer;
|
|
4
|
+
|
|
5
|
+
// key-val-store probes indexedDB; without it the SDK falls back to FileKeyValStore (process.cwd).
|
|
6
|
+
if (typeof globalThis.indexedDB === "undefined") {
|
|
7
|
+
globalThis.indexedDB = {};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (typeof global.require === "undefined") {
|
|
11
|
+
global.require = (m) => {
|
|
12
|
+
if (m === "react-native") return ReactNative;
|
|
13
|
+
throw new Error(`global.require shim: unsupported module "${m}"`);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare module '@hinkal/sdk/react-native/shims/globals';
|
|
2
|
+
declare module '@hinkal/sdk/react-native/shims/circomlibjs';
|
|
3
|
+
declare module '@hinkal/sdk/react-native/shims/circomlibjs-hinkal-fork';
|
|
4
|
+
declare module '@hinkal/sdk/react-native/shims/constants';
|
|
5
|
+
declare module '@hinkal/sdk/react-native/shims/crypto';
|
|
6
|
+
declare module '@hinkal/sdk/react-native/shims/ffjavascript';
|
|
7
|
+
declare module '@hinkal/sdk/react-native/shims/fs';
|
|
8
|
+
declare module '@hinkal/sdk/react-native/shims/idb-keyval';
|
|
9
|
+
declare module '@hinkal/sdk/react-native/shims/multiformats';
|
|
10
|
+
declare module '@hinkal/sdk/react-native/shims/os';
|
|
11
|
+
declare module '@hinkal/sdk/react-native/shims/path';
|
|
12
|
+
declare module '@hinkal/sdk/react-native/shims/readline';
|
|
13
|
+
declare module '@hinkal/sdk/react-native/shims/snarkjs';
|
|
14
|
+
declare module '@hinkal/sdk/react-native/shims/url';
|
|
15
|
+
declare module '@hinkal/sdk/react-native/shims/web-worker';
|
|
16
|
+
declare module '@hinkal/sdk/react-native/shims/worker_threads';
|
package/sdk/package.json.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={name:`@gurge/sdk`,version:`0.3.
|
|
1
|
+
var e={name:`@gurge/sdk`,version:`0.3.40`,homepage:`hinkal.io`,author:{name:`Hinkal Protocol`},keywords:[`blockchain`,`privacy`,`zero-knowledge`,`stealth addresses`],exports:{".":{types:`./index.d.ts`,"react-native":`./index.cjs`,import:`./index.mjs`,default:`./index.cjs`},"./providers/WagmiProviderAdapter":{types:`./providers/WagmiProviderAdapter.d.ts`,"react-native":`./providers/WagmiProviderAdapter.cjs`,import:`./providers/WagmiProviderAdapter.mjs`,default:`./providers/WagmiProviderAdapter.cjs`},"./providers/EthersProviderAdapter":{types:`./providers/EthersProviderAdapter.d.ts`,"react-native":`./providers/EthersProviderAdapter.cjs`,import:`./providers/EthersProviderAdapter.mjs`,default:`./providers/EthersProviderAdapter.cjs`},"./providers/TronProviderAdapter":{types:`./providers/TronProviderAdapter.d.ts`,"react-native":`./providers/TronProviderAdapter.cjs`,import:`./providers/TronProviderAdapter.mjs`,default:`./providers/TronProviderAdapter.cjs`},"./providers/SolanaProviderAdapter":{types:`./providers/SolanaProviderAdapter.d.ts`,"react-native":`./providers/SolanaProviderAdapter.cjs`,import:`./providers/SolanaProviderAdapter.mjs`,default:`./providers/SolanaProviderAdapter.cjs`},"./providers/prepareEthersHinkal":{types:`./providers/prepareEthersHinkal.d.ts`,"react-native":`./providers/prepareEthersHinkal.cjs`,import:`./providers/prepareEthersHinkal.mjs`,default:`./providers/prepareEthersHinkal.cjs`},"./providers/prepareWagmiHinkal":{types:`./providers/prepareWagmiHinkal.d.ts`,"react-native":`./providers/prepareWagmiHinkal.cjs`,import:`./providers/prepareWagmiHinkal.mjs`,default:`./providers/prepareWagmiHinkal.cjs`},"./providers/prepareTronHinkal":{types:`./providers/prepareTronHinkal.d.ts`,"react-native":`./providers/prepareTronHinkal.cjs`,import:`./providers/prepareTronHinkal.mjs`,default:`./providers/prepareTronHinkal.cjs`},"./providers/prepareSolanaHinkal":{types:`./providers/prepareSolanaHinkal.d.ts`,"react-native":`./providers/prepareSolanaHinkal.cjs`,import:`./providers/prepareSolanaHinkal.mjs`,default:`./providers/prepareSolanaHinkal.cjs`},"./react-native":{types:`./react-native/index.d.ts`,"react-native":`./react-native/index.cjs`,import:`./react-native/index.mjs`,default:`./react-native/index.cjs`},"./react-native/metro-config":`./react-native/metro-config.js`,"./react-native/shims/*":`./react-native/shims/*`},types:`./index.d.ts`,scripts:{prebuild:`nx prebuild:workers`,build:`nx build`,lint:`nx lint`,test:`nx test`},devDependencies:{nx:`22.6.4`,vite:`^8.0.4`,"vite-plugin-dts":`^4.5.4`,"vite-tsconfig-paths":`^6.1.1`},dependencies:{"@coral-xyz/anchor":`^0.31.0`,"@solana/spl-token":`^0.4.14`,"@solana/web3.js":`^1.98.4`,"@solana/wallet-adapter-react":`^0.15.39`,axios:`^1.15.0`,"async-mutex":`^0.4.0`,bs58:`^6.0.0`,buffer:`6.0.3`,"circomlibjs-hinkal-fork":`^0.0.10`,dotenv:`^16.4.5`,ethers:`^6.15.0`,"idb-keyval":`6.2.1`,multiformats:`^9.4.2`,snarkjs:`0.7.5`,"libsodium-wrappers":`^0.8.2`,lodash:`^4.17.21`,tweetnacl:`^1.0.3`,process:`0.11.10`,"ua-parser-js":`^1.0.37`,uuid:`^9.0.1`,"node-forge":`^1.3.1`,"poseidon-lite":`^0.3.0`,tronweb:`^6.2.0`},peerDependencies:{wagmi:`2.13.3`,"@walletconnect/utils":`^2.17.2`,"@react-native-async-storage/async-storage":`^2.2.0`,"react-native-get-random-values":`^1.11.0`},peerDependenciesMeta:{wagmi:{optional:!0},"@walletconnect/utils":{optional:!0},"@react-native-async-storage/async-storage":{optional:!0},"react-native-get-random-values":{optional:!0}}};exports.default=e;
|
package/sdk/package.json.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var e = {
|
|
2
2
|
name: "@gurge/sdk",
|
|
3
|
-
version: "0.3.
|
|
3
|
+
version: "0.3.40",
|
|
4
4
|
homepage: "hinkal.io",
|
|
5
5
|
author: { name: "Hinkal Protocol" },
|
|
6
6
|
keywords: [
|
|
@@ -12,11 +12,7 @@ var e = {
|
|
|
12
12
|
exports: {
|
|
13
13
|
".": {
|
|
14
14
|
types: "./index.d.ts",
|
|
15
|
-
"react-native":
|
|
16
|
-
types: "./index.d.ts",
|
|
17
|
-
import: "./index.mjs",
|
|
18
|
-
default: "./index.cjs"
|
|
19
|
-
},
|
|
15
|
+
"react-native": "./index.cjs",
|
|
20
16
|
import: "./index.mjs",
|
|
21
17
|
default: "./index.cjs"
|
|
22
18
|
},
|
|
@@ -68,13 +64,14 @@ var e = {
|
|
|
68
64
|
import: "./providers/prepareSolanaHinkal.mjs",
|
|
69
65
|
default: "./providers/prepareSolanaHinkal.cjs"
|
|
70
66
|
},
|
|
71
|
-
"./react-native
|
|
72
|
-
types: "./react-native/
|
|
73
|
-
"react-native": "./react-native/
|
|
74
|
-
import: "./react-native/
|
|
75
|
-
default: "./react-native/
|
|
67
|
+
"./react-native": {
|
|
68
|
+
types: "./react-native/index.d.ts",
|
|
69
|
+
"react-native": "./react-native/index.cjs",
|
|
70
|
+
import: "./react-native/index.mjs",
|
|
71
|
+
default: "./react-native/index.cjs"
|
|
76
72
|
},
|
|
77
|
-
"./react-native/metro-config": "./react-native/metro-config.js"
|
|
73
|
+
"./react-native/metro-config": "./react-native/metro-config.js",
|
|
74
|
+
"./react-native/shims/*": "./react-native/shims/*"
|
|
78
75
|
},
|
|
79
76
|
types: "./index.d.ts",
|
|
80
77
|
scripts: {
|
|
@@ -112,18 +109,19 @@ var e = {
|
|
|
112
109
|
uuid: "^9.0.1",
|
|
113
110
|
"node-forge": "^1.3.1",
|
|
114
111
|
"poseidon-lite": "^0.3.0",
|
|
115
|
-
tronweb: "^6.2.0"
|
|
116
|
-
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
117
|
-
assert: "^2.1.0",
|
|
118
|
-
"react-native-get-random-values": "^1.11.0"
|
|
112
|
+
tronweb: "^6.2.0"
|
|
119
113
|
},
|
|
120
114
|
peerDependencies: {
|
|
121
115
|
wagmi: "2.13.3",
|
|
122
|
-
"@walletconnect/utils": "^2.17.2"
|
|
116
|
+
"@walletconnect/utils": "^2.17.2",
|
|
117
|
+
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
118
|
+
"react-native-get-random-values": "^1.11.0"
|
|
123
119
|
},
|
|
124
120
|
peerDependenciesMeta: {
|
|
125
121
|
wagmi: { optional: !0 },
|
|
126
|
-
"@walletconnect/utils": { optional: !0 }
|
|
122
|
+
"@walletconnect/utils": { optional: !0 },
|
|
123
|
+
"@react-native-async-storage/async-storage": { optional: !0 },
|
|
124
|
+
"react-native-get-random-values": { optional: !0 }
|
|
127
125
|
}
|
|
128
126
|
};
|
|
129
127
|
//#endregion
|
package/react-native/setup.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`buffer`),n=require(`react-native`);n=e.__toESM(n),require(`react-native-get-random-values`),global.Buffer=t.Buffer,globalThis.indexedDB===void 0&&(globalThis.indexedDB={}),global.require===void 0&&(global.require=e=>{if(e===`react-native`)return n;throw Error(`global.require shim: unsupported module "${e}"`)});
|
package/react-native/setup.d.ts
DELETED
|
File without changes
|
package/react-native/setup.mjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Buffer as e } from "buffer";
|
|
2
|
-
import * as t from "react-native";
|
|
3
|
-
import "react-native-get-random-values";
|
|
4
|
-
global.Buffer = e, globalThis.indexedDB === void 0 && (globalThis.indexedDB = {}), global.require === void 0 && (global.require = (e) => {
|
|
5
|
-
if (e === "react-native") return t;
|
|
6
|
-
throw Error(`global.require shim: unsupported module "${e}"`);
|
|
7
|
-
});
|
|
8
|
-
//#endregion
|