@bennyblader/ddk-rn 0.1.4
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/DdkRn.podspec +44 -0
- package/LICENSE +20 -0
- package/README.md +33 -0
- package/android/CMakeLists.txt +76 -0
- package/android/build.gradle +144 -0
- package/android/cpp-adapter.cpp +63 -0
- package/android/gradle.properties +5 -0
- package/android/proguard-rules.pro +4 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/ddkrn/DdkRnModule.kt +43 -0
- package/android/src/main/java/com/ddkrn/DdkRnPackage.kt +34 -0
- package/cpp/bennyblader-ddk-rn.cpp +16 -0
- package/cpp/bennyblader-ddk-rn.h +15 -0
- package/cpp/ddk_ffi.cpp +2557 -0
- package/cpp/ddk_ffi.hpp +78 -0
- package/ios/DdkRn.h +16 -0
- package/ios/DdkRn.mm +66 -0
- package/lib/commonjs/NativeDdkRn.js +10 -0
- package/lib/commonjs/NativeDdkRn.js.map +1 -0
- package/lib/commonjs/ddk_ffi-ffi.js +44 -0
- package/lib/commonjs/ddk_ffi-ffi.js.map +1 -0
- package/lib/commonjs/ddk_ffi.js +1072 -0
- package/lib/commonjs/ddk_ffi.js.map +1 -0
- package/lib/commonjs/index.js +63 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/NativeDdkRn.js +7 -0
- package/lib/module/NativeDdkRn.js.map +1 -0
- package/lib/module/ddk_ffi-ffi.js +43 -0
- package/lib/module/ddk_ffi-ffi.js.map +1 -0
- package/lib/module/ddk_ffi.js +1052 -0
- package/lib/module/ddk_ffi.js.map +1 -0
- package/lib/module/index.js +43 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeDdkRn.d.ts +8 -0
- package/lib/typescript/commonjs/src/NativeDdkRn.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts +108 -0
- package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ddk_ffi.d.ts +773 -0
- package/lib/typescript/commonjs/src/ddk_ffi.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeDdkRn.d.ts +8 -0
- package/lib/typescript/module/src/NativeDdkRn.d.ts.map +1 -0
- package/lib/typescript/module/src/ddk_ffi-ffi.d.ts +108 -0
- package/lib/typescript/module/src/ddk_ffi-ffi.d.ts.map +1 -0
- package/lib/typescript/module/src/ddk_ffi.d.ts +773 -0
- package/lib/typescript/module/src/ddk_ffi.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +8 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +206 -0
- package/scripts/postinstall.js +130 -0
- package/src/NativeDdkRn.ts +10 -0
- package/src/ddk_ffi-ffi.ts +307 -0
- package/src/ddk_ffi.ts +1743 -0
- package/src/index.tsx +41 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ddk_ffi.d.ts","sourceRoot":"","sources":["../../../../src/ddk_ffi.ts"],"names":[],"mappings":"AAgCA,OAAO,EACL,KAAK,eAAe,EAQpB,UAAU,EAMV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AAarC,wBAAgB,SAAS,CACvB,WAAW,EAAE,QAAQ,EACrB,mBAAmB,EAAU,MAAM,EACnC,YAAY,EAAE,QAAQ,EACtB,oBAAoB,EAAU,MAAM,EACpC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAU,MAAM,EACxB,QAAQ,EAAU,MAAM,GACvB,WAAW,CAwBb;AACD,wBAAgB,uCAAuC,CACrD,GAAG,EAAE,WAAW,EAChB,U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;;;;uBA1sCc,UAAU;iDAMQ,UAAU,GAAG,IAAI;qDAIb,MAAM;;;;;uBAiD5B,UAAU;oDAOQ,UAAU,GAAG,IAAI;wDAKb,MAAM;;;;;uBAk7B5B,UAAU;yCAiCQ,UAAU,GAAG,IAAI;6CAKb,MAAM;;;;;uBAj6B5B,UAAU;6CAYQ,UAAU,GAAG,IAAI;iDAUb,MAAM;;;;;uBAsD5B,UAAU;2CAMQ,UAAU,GAAG,IAAI;+CAIb,MAAM;;;;;uBAkD5B,UAAU;gDAQQ,UAAU,GAAG,IAAI;oDAMb,MAAM;;;;;uBAkD5B,UAAU;2CAMQ,UAAU,GAAG,IAAI;+CAIb,MAAM;;;;;uBAuD5B,UAAU;4CAaQ,UAAU,GAAG,IAAI;gDAWb,MAAM;;;;;uBAqD5B,UAAU;uCAMQ,UAAU,GAAG,IAAI;2CAIb,MAAM;;;;;uBAmD5B,UAAU;4CASQ,UAAU,GAAG,IAAI;gDAOb,MAAM;;;;;uBAoD5B,UAAU;wCASQ,UAAU,GAAG,IAAI;4CAOb,MAAM;;;;;uBAsD5B,UAAU;4CASQ,UAAU,GAAG,IAAI;gDAOb,MAAM;;;;;uBAiD5B,UAAU;yCAMQ,UAAU,GAAG,IAAI;6CAIb,MAAM;;;;;;AAse3C,wBAiBG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAK3B,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AActC,wBAAsB,eAAe,kBAEpC;;;;AAGD,wBAEE"}
|
package/package.json
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bennyblader/ddk-rn",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "rust-dlc bindings for react-native",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"react-native": "./src/index.tsx",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
13
|
+
"default": "./lib/module/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
17
|
+
"default": "./lib/commonjs/index.js"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"src",
|
|
23
|
+
"lib",
|
|
24
|
+
"android",
|
|
25
|
+
"ios",
|
|
26
|
+
"cpp",
|
|
27
|
+
"scripts/postinstall.js",
|
|
28
|
+
"*.podspec",
|
|
29
|
+
"react-native.config.json",
|
|
30
|
+
"!ios/build",
|
|
31
|
+
"!ios/*.xcframework",
|
|
32
|
+
"!android/build",
|
|
33
|
+
"!android/gradle",
|
|
34
|
+
"!android/gradlew",
|
|
35
|
+
"!android/gradlew.bat",
|
|
36
|
+
"!android/local.properties",
|
|
37
|
+
"!android/src/main/jniLibs",
|
|
38
|
+
"!**/__tests__",
|
|
39
|
+
"!**/__fixtures__",
|
|
40
|
+
"!**/__mocks__",
|
|
41
|
+
"!**/.*"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"example": "pnpm --filter example",
|
|
45
|
+
"test": "jest",
|
|
46
|
+
"typecheck": "tsc",
|
|
47
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
48
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
49
|
+
"prepare": "bob build",
|
|
50
|
+
"postinstall": "node scripts/postinstall.js",
|
|
51
|
+
"release": "release-it",
|
|
52
|
+
"release-full": "node scripts/release.js",
|
|
53
|
+
"create-archives": "node scripts/create-binary-archives.js",
|
|
54
|
+
"uniffi:clean": "rm -rf cpp/DdkFFI.* src/DdkFFI.* src/types.ts ios/*.xcframework android/src/main/jniLibs",
|
|
55
|
+
"example:ios": "pnpm --filter example ios",
|
|
56
|
+
"example:android": "pnpm --filter example android",
|
|
57
|
+
"example:pods": "pnpm --filter example pod-install"
|
|
58
|
+
},
|
|
59
|
+
"keywords": [
|
|
60
|
+
"react-native",
|
|
61
|
+
"ios",
|
|
62
|
+
"android"
|
|
63
|
+
],
|
|
64
|
+
"repository": {
|
|
65
|
+
"type": "git",
|
|
66
|
+
"url": "git+https://github.com/bennyhodl/ddk-ffi.git"
|
|
67
|
+
},
|
|
68
|
+
"author": "benny b <ben@bitcoinbay.foundation> (https://github.com/bennyhodl)",
|
|
69
|
+
"license": "MIT",
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/bennyhodl/ddk-ffi/issues"
|
|
72
|
+
},
|
|
73
|
+
"homepage": "https://github.com/bennyhodl/ddk-ffi#readme",
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public",
|
|
76
|
+
"registry": "https://registry.npmjs.org/"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
80
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
81
|
+
"@react-native-community/cli": "15.0.0-alpha.2",
|
|
82
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
83
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
84
|
+
"@types/jest": "^29.5.5",
|
|
85
|
+
"@types/react": "^18.2.44",
|
|
86
|
+
"commitlint": "^17.0.2",
|
|
87
|
+
"del-cli": "^5.1.0",
|
|
88
|
+
"eslint": "^8.51.0",
|
|
89
|
+
"eslint-config-prettier": "^9.0.0",
|
|
90
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
91
|
+
"jest": "^29.7.0",
|
|
92
|
+
"prettier": "^3.0.3",
|
|
93
|
+
"react": "18.3.1",
|
|
94
|
+
"react-native": "0.75.5",
|
|
95
|
+
"react-native-builder-bob": "0.30.0",
|
|
96
|
+
"release-it": "^17.10.0",
|
|
97
|
+
"turbo": "^1.10.7",
|
|
98
|
+
"typescript": "^5.2.2"
|
|
99
|
+
},
|
|
100
|
+
"resolutions": {
|
|
101
|
+
"@types/react": "^18.2.44"
|
|
102
|
+
},
|
|
103
|
+
"peerDependencies": {
|
|
104
|
+
"react": "*",
|
|
105
|
+
"react-native": "*"
|
|
106
|
+
},
|
|
107
|
+
"packageManager": "yarn@3.6.1",
|
|
108
|
+
"jest": {
|
|
109
|
+
"preset": "react-native",
|
|
110
|
+
"modulePathIgnorePatterns": [
|
|
111
|
+
"<rootDir>/example/node_modules",
|
|
112
|
+
"<rootDir>/lib/"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"commitlint": {
|
|
116
|
+
"extends": [
|
|
117
|
+
"@commitlint/config-conventional"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"release-it": {
|
|
121
|
+
"git": {
|
|
122
|
+
"commitMessage": "chore: release ${version}",
|
|
123
|
+
"tagName": "v${version}"
|
|
124
|
+
},
|
|
125
|
+
"npm": {
|
|
126
|
+
"publish": true,
|
|
127
|
+
"access": "public"
|
|
128
|
+
},
|
|
129
|
+
"github": {
|
|
130
|
+
"release": true
|
|
131
|
+
},
|
|
132
|
+
"plugins": {
|
|
133
|
+
"@release-it/conventional-changelog": {
|
|
134
|
+
"preset": "angular"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"eslintConfig": {
|
|
139
|
+
"root": true,
|
|
140
|
+
"extends": [
|
|
141
|
+
"@react-native",
|
|
142
|
+
"prettier"
|
|
143
|
+
],
|
|
144
|
+
"rules": {
|
|
145
|
+
"react/react-in-jsx-scope": "off",
|
|
146
|
+
"prettier/prettier": [
|
|
147
|
+
"error",
|
|
148
|
+
{
|
|
149
|
+
"quoteProps": "consistent",
|
|
150
|
+
"singleQuote": true,
|
|
151
|
+
"tabWidth": 2,
|
|
152
|
+
"trailingComma": "es5",
|
|
153
|
+
"useTabs": false
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"eslintIgnore": [
|
|
159
|
+
"node_modules/",
|
|
160
|
+
"lib/"
|
|
161
|
+
],
|
|
162
|
+
"prettier": {
|
|
163
|
+
"quoteProps": "consistent",
|
|
164
|
+
"singleQuote": true,
|
|
165
|
+
"tabWidth": 2,
|
|
166
|
+
"trailingComma": "es5",
|
|
167
|
+
"useTabs": false
|
|
168
|
+
},
|
|
169
|
+
"react-native-builder-bob": {
|
|
170
|
+
"source": "src",
|
|
171
|
+
"output": "lib",
|
|
172
|
+
"targets": [
|
|
173
|
+
[
|
|
174
|
+
"commonjs",
|
|
175
|
+
{
|
|
176
|
+
"esm": true
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
"module",
|
|
181
|
+
{
|
|
182
|
+
"esm": true
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
[
|
|
186
|
+
"typescript",
|
|
187
|
+
{
|
|
188
|
+
"project": "tsconfig.build.json",
|
|
189
|
+
"esm": true
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
"codegenConfig": {
|
|
195
|
+
"name": "RNDdkRnSpec",
|
|
196
|
+
"type": "modules",
|
|
197
|
+
"jsSrcsDir": "src",
|
|
198
|
+
"android": {
|
|
199
|
+
"javaPackageName": "com.ddkrn"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
"dependencies": {
|
|
203
|
+
"@babel/runtime": "^7.20.0",
|
|
204
|
+
"uniffi-bindgen-react-native": "0.29.3-1"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const https = require('https');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
// Get package version to determine which release to download
|
|
9
|
+
// __dirname is ddk-rn/scripts/, so package.json is at ../package.json
|
|
10
|
+
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
|
11
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
12
|
+
const version = packageJson.version;
|
|
13
|
+
|
|
14
|
+
const GITHUB_REPO = 'bennyhodl/ddk-ffi';
|
|
15
|
+
const RELEASE_TAG = `v${version}`;
|
|
16
|
+
|
|
17
|
+
// Detect platform and architecture
|
|
18
|
+
const platform = process.platform;
|
|
19
|
+
const arch = process.arch;
|
|
20
|
+
|
|
21
|
+
console.log(`📦 Installing native binaries for ${platform}-${arch}...`);
|
|
22
|
+
|
|
23
|
+
// Create directories if they don't exist
|
|
24
|
+
const androidLibsDir = path.join(__dirname, '..', 'android', 'src', 'main', 'jniLibs');
|
|
25
|
+
const iosFrameworksDir = path.join(__dirname, '..', 'ios');
|
|
26
|
+
|
|
27
|
+
function ensureDir(dir) {
|
|
28
|
+
if (!fs.existsSync(dir)) {
|
|
29
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function downloadFile(url, dest) {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
console.log(`⬇️ Downloading ${url}`);
|
|
36
|
+
|
|
37
|
+
const file = fs.createWriteStream(dest);
|
|
38
|
+
|
|
39
|
+
https.get(url, (response) => {
|
|
40
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
41
|
+
// Follow redirect
|
|
42
|
+
return downloadFile(response.headers.location, dest).then(resolve).catch(reject);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (response.statusCode !== 200) {
|
|
46
|
+
reject(new Error(`Failed to download: ${response.statusCode} ${response.statusMessage}`));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
response.pipe(file);
|
|
51
|
+
|
|
52
|
+
file.on('finish', () => {
|
|
53
|
+
file.close();
|
|
54
|
+
console.log(`✅ Downloaded ${path.basename(dest)}`);
|
|
55
|
+
resolve();
|
|
56
|
+
});
|
|
57
|
+
}).on('error', (err) => {
|
|
58
|
+
fs.unlink(dest, () => {}); // Delete partial file
|
|
59
|
+
reject(err);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function extractTarGz(tarPath, extractDir) {
|
|
65
|
+
try {
|
|
66
|
+
console.log(`📂 Extracting ${path.basename(tarPath)}...`);
|
|
67
|
+
execSync(`tar -xzf "${tarPath}" -C "${extractDir}"`, { stdio: 'inherit' });
|
|
68
|
+
console.log(`✅ Extracted to ${extractDir}`);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
throw new Error(`Failed to extract ${tarPath}: ${error.message}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function downloadAndExtractBinaries() {
|
|
75
|
+
try {
|
|
76
|
+
// Download Android JNI libraries
|
|
77
|
+
const androidArchiveUrl = `https://github.com/${GITHUB_REPO}/releases/download/${RELEASE_TAG}/android-jni-libs.tar.gz`;
|
|
78
|
+
const androidTarPath = path.join(__dirname, '..', 'android-jni-libs.tar.gz');
|
|
79
|
+
|
|
80
|
+
ensureDir(androidLibsDir);
|
|
81
|
+
await downloadFile(androidArchiveUrl, androidTarPath);
|
|
82
|
+
extractTarGz(androidTarPath, path.join(__dirname, '..', 'android', 'src', 'main'));
|
|
83
|
+
fs.unlinkSync(androidTarPath); // Clean up
|
|
84
|
+
|
|
85
|
+
// Download iOS XCFramework (only on macOS for iOS development)
|
|
86
|
+
if (platform === 'darwin') {
|
|
87
|
+
const iosArchiveUrl = `https://github.com/${GITHUB_REPO}/releases/download/${RELEASE_TAG}/ios-xcframeworks.tar.gz`;
|
|
88
|
+
const iosTarPath = path.join(__dirname, '..', 'ios-xcframeworks.tar.gz');
|
|
89
|
+
|
|
90
|
+
ensureDir(iosFrameworksDir);
|
|
91
|
+
await downloadFile(iosArchiveUrl, iosTarPath);
|
|
92
|
+
extractTarGz(iosTarPath, iosFrameworksDir);
|
|
93
|
+
fs.unlinkSync(iosTarPath); // Clean up
|
|
94
|
+
} else {
|
|
95
|
+
console.log('⚠️ Skipping iOS binaries (not on macOS)');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log('🎉 All native binaries installed successfully!');
|
|
99
|
+
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error('❌ Failed to install native binaries:', error.message);
|
|
102
|
+
console.error('');
|
|
103
|
+
console.error('📋 Manual installation:');
|
|
104
|
+
console.error(` 1. Download binaries from: https://github.com/${GITHUB_REPO}/releases/tag/${RELEASE_TAG}`);
|
|
105
|
+
console.error(' 2. Extract android-jni-libs.tar.gz to android/src/main/');
|
|
106
|
+
console.error(' 3. Extract ios-xcframeworks.tar.gz to ios/ (macOS only)');
|
|
107
|
+
console.error('');
|
|
108
|
+
|
|
109
|
+
// Don't fail the installation - let users manually install if needed
|
|
110
|
+
process.exit(0);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Check if binaries already exist (skip if they do)
|
|
115
|
+
const androidLibExists = fs.existsSync(path.join(androidLibsDir, 'arm64-v8a'));
|
|
116
|
+
const iosFrameworkExists = fs.existsSync(path.join(iosFrameworksDir, 'DdkFFI.xcframework'));
|
|
117
|
+
|
|
118
|
+
if (androidLibExists && (platform !== 'darwin' || iosFrameworkExists)) {
|
|
119
|
+
console.log('✅ Native binaries already installed, skipping download.');
|
|
120
|
+
process.exit(0);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Only download if we're not in a CI environment or explicit opt-in
|
|
124
|
+
if (process.env.CI && !process.env.DOWNLOAD_BINARIES) {
|
|
125
|
+
console.log('⚠️ Skipping binary download in CI environment.');
|
|
126
|
+
console.log(' Set DOWNLOAD_BINARIES=1 to force download in CI.');
|
|
127
|
+
process.exit(0);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
downloadAndExtractBinaries();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
import type { TurboModule } from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
installRustCrate(): boolean;
|
|
7
|
+
cleanupRustCrate(): boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('DdkRn');
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type StructuralEquality as UniffiStructuralEquality,
|
|
6
|
+
type UniffiForeignFuture as RuntimeUniffiForeignFuture,
|
|
7
|
+
type UniffiRustCallStatus,
|
|
8
|
+
type UniffiRustArcPtr,
|
|
9
|
+
type UniffiRustFutureContinuationCallback as RuntimeUniffiRustFutureContinuationCallback,
|
|
10
|
+
type UniffiResult,
|
|
11
|
+
} from 'uniffi-bindgen-react-native';
|
|
12
|
+
|
|
13
|
+
interface NativeModuleInterface {
|
|
14
|
+
ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(
|
|
15
|
+
string: string,
|
|
16
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
17
|
+
): number;
|
|
18
|
+
ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
|
|
19
|
+
string: string,
|
|
20
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
21
|
+
): Uint8Array;
|
|
22
|
+
ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
|
|
23
|
+
buffer: Uint8Array,
|
|
24
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
25
|
+
): string;
|
|
26
|
+
ubrn_uniffi_ddk_ffi_fn_func_create_cet(
|
|
27
|
+
localOutput: Uint8Array,
|
|
28
|
+
localPayoutSerialId: bigint,
|
|
29
|
+
remoteOutput: Uint8Array,
|
|
30
|
+
remotePayoutSerialId: bigint,
|
|
31
|
+
fundTxId: Uint8Array,
|
|
32
|
+
fundVout: number,
|
|
33
|
+
lockTime: number,
|
|
34
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
35
|
+
): Uint8Array;
|
|
36
|
+
ubrn_uniffi_ddk_ffi_fn_func_create_cet_adaptor_signature_from_oracle_info(
|
|
37
|
+
cet: Uint8Array,
|
|
38
|
+
oracleInfo: Uint8Array,
|
|
39
|
+
fundingSk: Uint8Array,
|
|
40
|
+
fundingScriptPubkey: Uint8Array,
|
|
41
|
+
totalCollateral: bigint,
|
|
42
|
+
msgs: Uint8Array,
|
|
43
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
44
|
+
): Uint8Array;
|
|
45
|
+
ubrn_uniffi_ddk_ffi_fn_func_create_cets(
|
|
46
|
+
fundTxId: Uint8Array,
|
|
47
|
+
fundVout: number,
|
|
48
|
+
localFinalScriptPubkey: Uint8Array,
|
|
49
|
+
remoteFinalScriptPubkey: Uint8Array,
|
|
50
|
+
outcomes: Uint8Array,
|
|
51
|
+
lockTime: number,
|
|
52
|
+
localSerialId: bigint,
|
|
53
|
+
remoteSerialId: bigint,
|
|
54
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
55
|
+
): Uint8Array;
|
|
56
|
+
ubrn_uniffi_ddk_ffi_fn_func_create_dlc_transactions(
|
|
57
|
+
outcomes: Uint8Array,
|
|
58
|
+
localParams: Uint8Array,
|
|
59
|
+
remoteParams: Uint8Array,
|
|
60
|
+
refundLocktime: number,
|
|
61
|
+
feeRate: bigint,
|
|
62
|
+
fundLockTime: number,
|
|
63
|
+
cetLockTime: number,
|
|
64
|
+
fundOutputSerialId: bigint,
|
|
65
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
66
|
+
): Uint8Array;
|
|
67
|
+
ubrn_uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script(
|
|
68
|
+
localFundPubkey: Uint8Array,
|
|
69
|
+
remoteFundPubkey: Uint8Array,
|
|
70
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
71
|
+
): Uint8Array;
|
|
72
|
+
ubrn_uniffi_ddk_ffi_fn_func_create_refund_transaction(
|
|
73
|
+
localFinalScriptPubkey: Uint8Array,
|
|
74
|
+
remoteFinalScriptPubkey: Uint8Array,
|
|
75
|
+
localAmount: bigint,
|
|
76
|
+
remoteAmount: bigint,
|
|
77
|
+
lockTime: number,
|
|
78
|
+
fundTxId: Uint8Array,
|
|
79
|
+
fundVout: number,
|
|
80
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
81
|
+
): Uint8Array;
|
|
82
|
+
ubrn_uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions(
|
|
83
|
+
outcomes: Uint8Array,
|
|
84
|
+
localParams: Uint8Array,
|
|
85
|
+
remoteParams: Uint8Array,
|
|
86
|
+
refundLocktime: number,
|
|
87
|
+
feeRate: bigint,
|
|
88
|
+
fundLockTime: number,
|
|
89
|
+
cetLockTime: number,
|
|
90
|
+
fundOutputSerialId: bigint,
|
|
91
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
92
|
+
): Uint8Array;
|
|
93
|
+
ubrn_uniffi_ddk_ffi_fn_func_get_change_output_and_fees(
|
|
94
|
+
params: Uint8Array,
|
|
95
|
+
feeRate: bigint,
|
|
96
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
97
|
+
): Uint8Array;
|
|
98
|
+
ubrn_uniffi_ddk_ffi_fn_func_get_raw_funding_transaction_input_signature(
|
|
99
|
+
fundingTransaction: Uint8Array,
|
|
100
|
+
privkey: Uint8Array,
|
|
101
|
+
prevTxId: Uint8Array,
|
|
102
|
+
prevTxVout: number,
|
|
103
|
+
value: bigint,
|
|
104
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
105
|
+
): Uint8Array;
|
|
106
|
+
ubrn_uniffi_ddk_ffi_fn_func_get_total_input_vsize(
|
|
107
|
+
inputs: Uint8Array,
|
|
108
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
109
|
+
): number;
|
|
110
|
+
ubrn_uniffi_ddk_ffi_fn_func_is_dust_output(
|
|
111
|
+
output: Uint8Array,
|
|
112
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
113
|
+
): number;
|
|
114
|
+
ubrn_uniffi_ddk_ffi_fn_func_sign_fund_transaction_input(
|
|
115
|
+
fundTransaction: Uint8Array,
|
|
116
|
+
privkey: Uint8Array,
|
|
117
|
+
prevTxId: Uint8Array,
|
|
118
|
+
prevTxVout: number,
|
|
119
|
+
value: bigint,
|
|
120
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
121
|
+
): Uint8Array;
|
|
122
|
+
ubrn_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature(
|
|
123
|
+
fundTx: Uint8Array,
|
|
124
|
+
signature: Uint8Array,
|
|
125
|
+
pubkey: Uint8Array,
|
|
126
|
+
txid: Uint8Array,
|
|
127
|
+
vout: number,
|
|
128
|
+
inputAmount: bigint,
|
|
129
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
130
|
+
): number;
|
|
131
|
+
ubrn_uniffi_ddk_ffi_fn_func_version(
|
|
132
|
+
uniffi_out_err: UniffiRustCallStatus
|
|
133
|
+
): Uint8Array;
|
|
134
|
+
ubrn_uniffi_ddk_ffi_checksum_func_create_cet(): number;
|
|
135
|
+
ubrn_uniffi_ddk_ffi_checksum_func_create_cet_adaptor_signature_from_oracle_info(): number;
|
|
136
|
+
ubrn_uniffi_ddk_ffi_checksum_func_create_cets(): number;
|
|
137
|
+
ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_transactions(): number;
|
|
138
|
+
ubrn_uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script(): number;
|
|
139
|
+
ubrn_uniffi_ddk_ffi_checksum_func_create_refund_transaction(): number;
|
|
140
|
+
ubrn_uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions(): number;
|
|
141
|
+
ubrn_uniffi_ddk_ffi_checksum_func_get_change_output_and_fees(): number;
|
|
142
|
+
ubrn_uniffi_ddk_ffi_checksum_func_get_raw_funding_transaction_input_signature(): number;
|
|
143
|
+
ubrn_uniffi_ddk_ffi_checksum_func_get_total_input_vsize(): number;
|
|
144
|
+
ubrn_uniffi_ddk_ffi_checksum_func_is_dust_output(): number;
|
|
145
|
+
ubrn_uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input(): number;
|
|
146
|
+
ubrn_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature(): number;
|
|
147
|
+
ubrn_uniffi_ddk_ffi_checksum_func_version(): number;
|
|
148
|
+
ubrn_ffi_ddk_ffi_uniffi_contract_version(): number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Casting globalThis to any allows us to look for `NativeDdkFfi`
|
|
152
|
+
// if it was added via JSI.
|
|
153
|
+
//
|
|
154
|
+
// We use a getter here rather than simply `globalThis.NativeDdkFfi` so that
|
|
155
|
+
// if/when the startup sequence isn't just so, an empty value isn't inadvertantly cached.
|
|
156
|
+
const getter: () => NativeModuleInterface = () =>
|
|
157
|
+
(globalThis as any).NativeDdkFfi;
|
|
158
|
+
export default getter;
|
|
159
|
+
|
|
160
|
+
// Structs and function types for calling back into Typescript from Rust.
|
|
161
|
+
export type UniffiRustFutureContinuationCallback = (
|
|
162
|
+
data: bigint,
|
|
163
|
+
pollResult: number
|
|
164
|
+
) => void;
|
|
165
|
+
type UniffiForeignFutureFree = (handle: bigint) => void;
|
|
166
|
+
type UniffiCallbackInterfaceFree = (handle: bigint) => void;
|
|
167
|
+
export type UniffiForeignFuture = {
|
|
168
|
+
handle: bigint;
|
|
169
|
+
free: UniffiForeignFutureFree;
|
|
170
|
+
};
|
|
171
|
+
export type UniffiForeignFutureStructU8 = {
|
|
172
|
+
returnValue: number;
|
|
173
|
+
callStatus: UniffiRustCallStatus;
|
|
174
|
+
};
|
|
175
|
+
export type UniffiForeignFutureCompleteU8 = (
|
|
176
|
+
callbackData: bigint,
|
|
177
|
+
result: UniffiForeignFutureStructU8
|
|
178
|
+
) => void;
|
|
179
|
+
export type UniffiForeignFutureStructI8 = {
|
|
180
|
+
returnValue: number;
|
|
181
|
+
callStatus: UniffiRustCallStatus;
|
|
182
|
+
};
|
|
183
|
+
export type UniffiForeignFutureCompleteI8 = (
|
|
184
|
+
callbackData: bigint,
|
|
185
|
+
result: UniffiForeignFutureStructI8
|
|
186
|
+
) => void;
|
|
187
|
+
export type UniffiForeignFutureStructU16 = {
|
|
188
|
+
returnValue: number;
|
|
189
|
+
callStatus: UniffiRustCallStatus;
|
|
190
|
+
};
|
|
191
|
+
export type UniffiForeignFutureCompleteU16 = (
|
|
192
|
+
callbackData: bigint,
|
|
193
|
+
result: UniffiForeignFutureStructU16
|
|
194
|
+
) => void;
|
|
195
|
+
export type UniffiForeignFutureStructI16 = {
|
|
196
|
+
returnValue: number;
|
|
197
|
+
callStatus: UniffiRustCallStatus;
|
|
198
|
+
};
|
|
199
|
+
export type UniffiForeignFutureCompleteI16 = (
|
|
200
|
+
callbackData: bigint,
|
|
201
|
+
result: UniffiForeignFutureStructI16
|
|
202
|
+
) => void;
|
|
203
|
+
export type UniffiForeignFutureStructU32 = {
|
|
204
|
+
returnValue: number;
|
|
205
|
+
callStatus: UniffiRustCallStatus;
|
|
206
|
+
};
|
|
207
|
+
export type UniffiForeignFutureCompleteU32 = (
|
|
208
|
+
callbackData: bigint,
|
|
209
|
+
result: UniffiForeignFutureStructU32
|
|
210
|
+
) => void;
|
|
211
|
+
export type UniffiForeignFutureStructI32 = {
|
|
212
|
+
returnValue: number;
|
|
213
|
+
callStatus: UniffiRustCallStatus;
|
|
214
|
+
};
|
|
215
|
+
export type UniffiForeignFutureCompleteI32 = (
|
|
216
|
+
callbackData: bigint,
|
|
217
|
+
result: UniffiForeignFutureStructI32
|
|
218
|
+
) => void;
|
|
219
|
+
export type UniffiForeignFutureStructU64 = {
|
|
220
|
+
returnValue: bigint;
|
|
221
|
+
callStatus: UniffiRustCallStatus;
|
|
222
|
+
};
|
|
223
|
+
export type UniffiForeignFutureCompleteU64 = (
|
|
224
|
+
callbackData: bigint,
|
|
225
|
+
result: UniffiForeignFutureStructU64
|
|
226
|
+
) => void;
|
|
227
|
+
export type UniffiForeignFutureStructI64 = {
|
|
228
|
+
returnValue: bigint;
|
|
229
|
+
callStatus: UniffiRustCallStatus;
|
|
230
|
+
};
|
|
231
|
+
export type UniffiForeignFutureCompleteI64 = (
|
|
232
|
+
callbackData: bigint,
|
|
233
|
+
result: UniffiForeignFutureStructI64
|
|
234
|
+
) => void;
|
|
235
|
+
export type UniffiForeignFutureStructF32 = {
|
|
236
|
+
returnValue: number;
|
|
237
|
+
callStatus: UniffiRustCallStatus;
|
|
238
|
+
};
|
|
239
|
+
export type UniffiForeignFutureCompleteF32 = (
|
|
240
|
+
callbackData: bigint,
|
|
241
|
+
result: UniffiForeignFutureStructF32
|
|
242
|
+
) => void;
|
|
243
|
+
export type UniffiForeignFutureStructF64 = {
|
|
244
|
+
returnValue: number;
|
|
245
|
+
callStatus: UniffiRustCallStatus;
|
|
246
|
+
};
|
|
247
|
+
export type UniffiForeignFutureCompleteF64 = (
|
|
248
|
+
callbackData: bigint,
|
|
249
|
+
result: UniffiForeignFutureStructF64
|
|
250
|
+
) => void;
|
|
251
|
+
export type UniffiForeignFutureStructPointer = {
|
|
252
|
+
returnValue: bigint;
|
|
253
|
+
callStatus: UniffiRustCallStatus;
|
|
254
|
+
};
|
|
255
|
+
export type UniffiForeignFutureCompletePointer = (
|
|
256
|
+
callbackData: bigint,
|
|
257
|
+
result: UniffiForeignFutureStructPointer
|
|
258
|
+
) => void;
|
|
259
|
+
export type UniffiForeignFutureStructRustBuffer = {
|
|
260
|
+
returnValue: Uint8Array;
|
|
261
|
+
callStatus: UniffiRustCallStatus;
|
|
262
|
+
};
|
|
263
|
+
export type UniffiForeignFutureCompleteRustBuffer = (
|
|
264
|
+
callbackData: bigint,
|
|
265
|
+
result: UniffiForeignFutureStructRustBuffer
|
|
266
|
+
) => void;
|
|
267
|
+
export type UniffiForeignFutureStructVoid = {
|
|
268
|
+
callStatus: UniffiRustCallStatus;
|
|
269
|
+
};
|
|
270
|
+
export type UniffiForeignFutureCompleteVoid = (
|
|
271
|
+
callbackData: bigint,
|
|
272
|
+
result: UniffiForeignFutureStructVoid
|
|
273
|
+
) => void;
|
|
274
|
+
|
|
275
|
+
// UniffiRustFutureContinuationCallback is generated as part of the component interface's
|
|
276
|
+
// ffi_definitions. However, we need it in the runtime.
|
|
277
|
+
// We could:
|
|
278
|
+
// (a) do some complicated template logic to ensure the declaration is not generated here (possible)
|
|
279
|
+
// (b) import the generated declaration into the runtime (m a y b e) or…
|
|
280
|
+
// (c) generate the declaration anyway, and use a different declaration in the runtime.
|
|
281
|
+
//
|
|
282
|
+
// We chose (c) here as the simplest. In addition, we perform a compile time check that
|
|
283
|
+
// the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
|
|
284
|
+
//
|
|
285
|
+
// If you see the error:
|
|
286
|
+
// ```
|
|
287
|
+
// Type 'true' is not assignable to type 'false'.(2322)
|
|
288
|
+
// ```
|
|
289
|
+
// Then a new version of uniffi has changed the signature of the callback. Most likely, code in
|
|
290
|
+
// `typescript/src/async-rust-call.ts` will need to be changed.
|
|
291
|
+
//
|
|
292
|
+
// If you see the error:
|
|
293
|
+
// ```
|
|
294
|
+
// Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
|
|
295
|
+
// ```
|
|
296
|
+
// then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
|
|
297
|
+
// You should not generate this if that is the case.
|
|
298
|
+
//
|
|
299
|
+
// ('You' being the bindings generator maintainer).
|
|
300
|
+
const isRustFutureContinuationCallbackTypeCompatible: UniffiStructuralEquality<
|
|
301
|
+
RuntimeUniffiRustFutureContinuationCallback,
|
|
302
|
+
UniffiRustFutureContinuationCallback
|
|
303
|
+
> = true;
|
|
304
|
+
const isUniffiForeignFutureTypeCompatible: UniffiStructuralEquality<
|
|
305
|
+
RuntimeUniffiForeignFuture,
|
|
306
|
+
UniffiForeignFuture
|
|
307
|
+
> = true;
|