@gurge/sdk 0.3.40 → 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/HinkalProvider.mjs +0 -1
- package/react-native/HinkalWebViewWorker.cjs +2 -2
- package/react-native/HinkalWebViewWorker.mjs +43 -39
- 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 +2 -10
- 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 -10
|
@@ -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`)
|
|
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(`./bridge/serialization.utils.cjs`),
|
|
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;`,
|
|
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;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { WORKER_CDN_URLS as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { WorkerFactory as e } from "../common/src/webworker/workerFactory.mjs";
|
|
2
|
+
import { WORKER_CDN_URLS as t } from "./workerCDNUrls.mjs";
|
|
3
|
+
import { bigIntReplacer as n, reviveBigInts as r } from "./bridge/serialization.utils.mjs";
|
|
4
|
+
import { HinkalRNWorker as i } from "./bridge/HinkalRNWorker.mjs";
|
|
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
|
+
import { WebView as d } from "react-native-webview";
|
|
8
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
7
9
|
//#region libs/shared/sdk/src/react-native/HinkalWebViewWorker.tsx
|
|
8
|
-
var
|
|
10
|
+
var p = `${new URL(Object.values(t)[0]).origin}/`;
|
|
11
|
+
e.rnWorkerFactory = (e) => new i(e);
|
|
12
|
+
var m = `
|
|
9
13
|
if (!window.__hinkalPageBoot) (function(){
|
|
10
14
|
window.__hinkalPageBoot = true;
|
|
11
|
-
var URLS = ${JSON.stringify(
|
|
15
|
+
var URLS = ${JSON.stringify(t)};
|
|
12
16
|
var BLOBS = {};
|
|
13
17
|
|
|
14
18
|
function replacer(_key, value){
|
|
@@ -89,82 +93,82 @@ if (!window.__hinkalPageBoot) (function(){
|
|
|
89
93
|
|
|
90
94
|
post({ type: 'READY' });
|
|
91
95
|
})();
|
|
92
|
-
true;`,
|
|
96
|
+
true;`, h = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script>${m}<\/script></body></html>`, g = o.create({ hiddenHost: {
|
|
93
97
|
position: "absolute",
|
|
94
98
|
height: 1,
|
|
95
99
|
width: 1,
|
|
96
100
|
left: -9999,
|
|
97
101
|
top: -9999,
|
|
98
102
|
opacity: 0
|
|
99
|
-
} }),
|
|
100
|
-
let
|
|
103
|
+
} }), _ = () => {
|
|
104
|
+
let e = u(null), t = u({
|
|
101
105
|
ready: !1,
|
|
102
106
|
queue: []
|
|
103
|
-
}),
|
|
107
|
+
}), i = c((t, r, i) => {
|
|
104
108
|
let o;
|
|
105
109
|
try {
|
|
106
110
|
o = JSON.stringify({
|
|
107
111
|
requestId: t,
|
|
108
|
-
variant:
|
|
109
|
-
message:
|
|
110
|
-
},
|
|
112
|
+
variant: r,
|
|
113
|
+
message: i
|
|
114
|
+
}, n);
|
|
111
115
|
} catch (e) {
|
|
112
|
-
|
|
116
|
+
a.emit("FROM_WEBVIEW_WORKER", {
|
|
113
117
|
requestId: t,
|
|
114
118
|
type: "ERROR",
|
|
115
119
|
error: `serialize failed: ${e?.message ?? e}`
|
|
116
120
|
});
|
|
117
121
|
return;
|
|
118
122
|
}
|
|
119
|
-
|
|
123
|
+
e.current?.injectJavaScript(`window.handleMessage && window.handleMessage(${o}); true;`);
|
|
120
124
|
}, []);
|
|
121
|
-
|
|
122
|
-
let e =
|
|
123
|
-
let
|
|
125
|
+
l(() => {
|
|
126
|
+
let e = a.addListener("TO_WEBVIEW_WORKER", (e) => {
|
|
127
|
+
let n = {
|
|
124
128
|
requestId: e?.__requestId ?? "",
|
|
125
129
|
variant: e?.variant ?? "",
|
|
126
130
|
message: e?.message
|
|
127
131
|
};
|
|
128
|
-
|
|
132
|
+
t.current.ready ? i(n.requestId, n.variant, n.message) : t.current.queue.push(n);
|
|
129
133
|
});
|
|
130
134
|
return () => e.remove();
|
|
131
|
-
}, [
|
|
132
|
-
let
|
|
135
|
+
}, [i]);
|
|
136
|
+
let o = c((e) => {
|
|
133
137
|
let n;
|
|
134
138
|
try {
|
|
135
|
-
n =
|
|
139
|
+
n = r(JSON.parse(e.nativeEvent.data));
|
|
136
140
|
} catch (e) {
|
|
137
|
-
|
|
141
|
+
a.emit("FROM_WEBVIEW_WORKER", {
|
|
138
142
|
type: "ERROR",
|
|
139
143
|
error: e?.message ?? "parse error"
|
|
140
144
|
});
|
|
141
145
|
return;
|
|
142
146
|
}
|
|
143
147
|
if (n?.type === "READY") {
|
|
144
|
-
|
|
145
|
-
let e =
|
|
146
|
-
|
|
148
|
+
t.current.ready = !0;
|
|
149
|
+
let e = t.current.queue;
|
|
150
|
+
t.current.queue = [], e.forEach(({ requestId: e, variant: t, message: n }) => i(e, t, n));
|
|
147
151
|
return;
|
|
148
152
|
}
|
|
149
|
-
|
|
150
|
-
}, [
|
|
151
|
-
return /* @__PURE__ */
|
|
153
|
+
a.emit("FROM_WEBVIEW_WORKER", n);
|
|
154
|
+
}, [i]);
|
|
155
|
+
return /* @__PURE__ */ f(s, {
|
|
152
156
|
pointerEvents: "none",
|
|
153
|
-
style:
|
|
154
|
-
children: /* @__PURE__ */
|
|
155
|
-
ref:
|
|
157
|
+
style: g.hiddenHost,
|
|
158
|
+
children: /* @__PURE__ */ f(d, {
|
|
159
|
+
ref: e,
|
|
156
160
|
source: {
|
|
157
|
-
html:
|
|
158
|
-
baseUrl:
|
|
161
|
+
html: h,
|
|
162
|
+
baseUrl: p
|
|
159
163
|
},
|
|
160
164
|
originWhitelist: ["*"],
|
|
161
165
|
javaScriptEnabled: !0,
|
|
162
166
|
domStorageEnabled: !0,
|
|
163
167
|
androidLayerType: "hardware",
|
|
164
|
-
onMessage:
|
|
165
|
-
onLoad: () =>
|
|
168
|
+
onMessage: o,
|
|
169
|
+
onLoad: () => e.current?.injectJavaScript(m)
|
|
166
170
|
})
|
|
167
171
|
});
|
|
168
172
|
};
|
|
169
173
|
//#endregion
|
|
170
|
-
export {
|
|
174
|
+
export { _ as default };
|
|
@@ -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,12 +8,6 @@
|
|
|
8
8
|
*
|
|
9
9
|
* const config = getDefaultConfig(__dirname);
|
|
10
10
|
* module.exports = applyHinkalMetroConfig(config);
|
|
11
|
-
*
|
|
12
|
-
* In `index.ts`, import setup before any other `@hinkal/sdk` code:
|
|
13
|
-
*
|
|
14
|
-
* import "@hinkal/sdk/react-native/setup";
|
|
15
|
-
*
|
|
16
|
-
* Wrap your app with `HinkalProvider` from `@hinkal/sdk`.
|
|
17
11
|
*/
|
|
18
12
|
const path = require('path');
|
|
19
13
|
|
|
@@ -23,8 +17,7 @@ const shim = (name) => ({
|
|
|
23
17
|
type: 'sourceFile',
|
|
24
18
|
});
|
|
25
19
|
|
|
26
|
-
const isFromHinkalSdk = (originPath) =>
|
|
27
|
-
!!originPath && (originPath.includes('/@hinkal/sdk/') || originPath.includes('/@gurge/sdk/'));
|
|
20
|
+
const isFromHinkalSdk = (originPath) => !!originPath && originPath.includes('/@hinkal/sdk/');
|
|
28
21
|
|
|
29
22
|
const applyHinkalMetroConfig = (config) => {
|
|
30
23
|
if (!config || !config.resolver) {
|
|
@@ -46,7 +39,6 @@ const applyHinkalMetroConfig = (config) => {
|
|
|
46
39
|
constants: path.join(shimDir, 'constants.js'),
|
|
47
40
|
'web-worker': path.join(shimDir, 'web-worker.js'),
|
|
48
41
|
url: path.join(shimDir, 'url.js'),
|
|
49
|
-
assert: require.resolve('assert/'),
|
|
50
42
|
};
|
|
51
43
|
|
|
52
44
|
const prevGetTransformOptions = config.transformer && config.transformer.getTransformOptions;
|
|
@@ -59,6 +51,7 @@ const applyHinkalMetroConfig = (config) => {
|
|
|
59
51
|
transform: {
|
|
60
52
|
...(upstream.transform || {}),
|
|
61
53
|
experimentalImportSupport: false,
|
|
54
|
+
inlineRequires: true,
|
|
62
55
|
},
|
|
63
56
|
};
|
|
64
57
|
},
|
|
@@ -73,7 +66,6 @@ const applyHinkalMetroConfig = (config) => {
|
|
|
73
66
|
if (moduleName === 'circomlibjs') return shim('circomlibjs');
|
|
74
67
|
if (moduleName === 'circomlibjs-hinkal-fork') return shim('circomlibjs-hinkal-fork');
|
|
75
68
|
if (moduleName === 'idb-keyval') return shim('idb-keyval');
|
|
76
|
-
if (moduleName === 'assert') return { filePath: require.resolve('assert/'), type: 'sourceFile' };
|
|
77
69
|
|
|
78
70
|
if (isFromHinkalSdk(context.originModulePath)) {
|
|
79
71
|
if (moduleName === 'multiformats' || moduleName.startsWith('multiformats/')) return shim('multiformats');
|
|
@@ -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`),t=require(`../common/src/webworker/workerFactory.cjs`),n=require(`./bridge/HinkalRNWorker.cjs`);let r=require(`buffer`);require(`react-native-get-random-values`);let i=require(`react-native`);i=e.__toESM(i),global.Buffer=r.Buffer,globalThis.indexedDB===void 0&&(globalThis.indexedDB={}),global.require===void 0&&(global.require=e=>{if(e===`react-native`)return i;throw Error(`global.require shim: unsupported module "${e}"`)}),t.WorkerFactory.rnWorkerFactory=e=>new n.HinkalRNWorker(e);
|
package/react-native/setup.d.ts
DELETED
|
File without changes
|
package/react-native/setup.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { WorkerFactory as e } from "../common/src/webworker/workerFactory.mjs";
|
|
2
|
-
import { HinkalRNWorker as t } from "./bridge/HinkalRNWorker.mjs";
|
|
3
|
-
import { Buffer as n } from "buffer";
|
|
4
|
-
import "react-native-get-random-values";
|
|
5
|
-
import * as r from "react-native";
|
|
6
|
-
global.Buffer = n, globalThis.indexedDB === void 0 && (globalThis.indexedDB = {}), global.require === void 0 && (global.require = (e) => {
|
|
7
|
-
if (e === "react-native") return r;
|
|
8
|
-
throw Error(`global.require shim: unsupported module "${e}"`);
|
|
9
|
-
}), e.rnWorkerFactory = (e) => new t(e);
|
|
10
|
-
//#endregion
|