@breeztech/breez-sdk-spark-react-native 0.6.4-dev3 → 0.6.4-dev6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breeztech/breez-sdk-spark-react-native",
|
|
3
|
-
"version": "0.6.4-
|
|
3
|
+
"version": "0.6.4-dev6",
|
|
4
4
|
"description": "React Native bindings for the Breez SDK - Nodeless (Spark Implementation)",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"src",
|
|
23
23
|
"lib",
|
|
24
24
|
"android",
|
|
25
|
-
"build",
|
|
26
25
|
"ios",
|
|
27
26
|
"cpp",
|
|
28
27
|
"*.podspec",
|
|
@@ -49,6 +48,7 @@
|
|
|
49
48
|
"plugin:build": "EXPO_NONINTERACTIVE=true expo-module build plugin",
|
|
50
49
|
"plugin:clean": "expo-module clean plugin",
|
|
51
50
|
"plugin:watch": "expo-module build plugin",
|
|
51
|
+
"postinstall": "./scripts/postinstall.sh",
|
|
52
52
|
"prepare": "bob build && yarn plugin:build",
|
|
53
53
|
"release": "release-it --only-version",
|
|
54
54
|
"typecheck": "tsc",
|
|
@@ -195,5 +195,9 @@
|
|
|
195
195
|
"type": "turbo-module",
|
|
196
196
|
"languages": "cpp",
|
|
197
197
|
"version": "0.49.0"
|
|
198
|
+
},
|
|
199
|
+
"checksums": {
|
|
200
|
+
"android": "7ca7604821bde3daa87aff071408b9ee8941e9b9a6fdd66c188dab6592aa8379",
|
|
201
|
+
"ios": "a8ff4b11866fdfc520655d7864d413070bb7e9038c5bc95085f1d369cc8db019"
|
|
198
202
|
}
|
|
199
203
|
}
|
package/plugin/build/index.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { type ConfigPlugin } from '@expo/config-plugins';
|
|
2
|
-
export type BreezSdkPluginOptions = {
|
|
2
|
+
export type BreezSdkPluginOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Skip downloading binary artifacts (default: false)
|
|
5
|
+
* Set to true if you want to handle binary downloads manually
|
|
6
|
+
*/
|
|
7
|
+
skipBinaryDownload?: boolean;
|
|
8
|
+
};
|
|
3
9
|
declare const _default: ConfigPlugin<void | BreezSdkPluginOptions>;
|
|
4
10
|
export default _default;
|
package/plugin/build/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
+
const withBinaryArtifacts_1 = require("./withBinaryArtifacts");
|
|
4
5
|
const withAndroid_1 = require("./withAndroid");
|
|
5
6
|
const withIOS_1 = require("./withIOS");
|
|
6
7
|
const utils_1 = require("./utils");
|
|
7
8
|
const withBreezSdk = (config, options) => {
|
|
8
|
-
const {} = options || {};
|
|
9
|
+
const { skipBinaryDownload = false } = options || {};
|
|
9
10
|
return (0, config_plugins_1.withPlugins)(config, [
|
|
11
|
+
// Download binary artifacts first
|
|
12
|
+
...(skipBinaryDownload ? [] : [withBinaryArtifacts_1.withBinaryArtifacts]),
|
|
10
13
|
// Configure Android
|
|
11
14
|
withAndroid_1.withBreezSdkAndroid,
|
|
12
15
|
// Configure iOS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/utils.ts","../src/withandroid.ts","../src/withios.ts"],"version":"5.9.2"}
|
|
1
|
+
{"root":["../src/index.ts","../src/utils.ts","../src/withandroid.ts","../src/withbinaryartifacts.ts","../src/withios.ts"],"version":"5.9.2"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.withBinaryArtifacts = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const child_process_1 = require("child_process");
|
|
40
|
+
/**
|
|
41
|
+
* Downloads prebuilt binary artifacts for Android and iOS
|
|
42
|
+
* This runs during expo prebuild to ensure binaries are available
|
|
43
|
+
*/
|
|
44
|
+
const withBinaryArtifacts = (config) => {
|
|
45
|
+
return {
|
|
46
|
+
...config,
|
|
47
|
+
async prebuildAsync(config) {
|
|
48
|
+
try {
|
|
49
|
+
await downloadBinaryArtifacts();
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
console.warn('Failed to download Breez SDK binary artifacts:', error);
|
|
53
|
+
console.warn('You may need to run the postinstall script manually or check your network connection.');
|
|
54
|
+
}
|
|
55
|
+
return config;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.withBinaryArtifacts = withBinaryArtifacts;
|
|
60
|
+
async function downloadBinaryArtifacts() {
|
|
61
|
+
const packageRoot = findPackageRoot();
|
|
62
|
+
if (!packageRoot) {
|
|
63
|
+
throw new Error('Could not find @breeztech/breez-sdk-spark-react-native package');
|
|
64
|
+
}
|
|
65
|
+
// Check if artifacts already exist
|
|
66
|
+
const androidLibsPath = path.join(packageRoot, 'android/src/main/jniLibs');
|
|
67
|
+
const iosFrameworkPath = path.join(packageRoot, 'build/RnBreezSdkSpark.xcframework');
|
|
68
|
+
if (fs.existsSync(androidLibsPath) && fs.existsSync(iosFrameworkPath)) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const packageJsonPath = path.join(packageRoot, 'package.json');
|
|
72
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
73
|
+
const version = packageJson.version;
|
|
74
|
+
const androidChecksum = packageJson.checksums?.android;
|
|
75
|
+
const iosChecksum = packageJson.checksums?.ios;
|
|
76
|
+
if (!androidChecksum || !iosChecksum) {
|
|
77
|
+
throw new Error('Binary checksums not found in package.json');
|
|
78
|
+
}
|
|
79
|
+
const repo = 'https://github.com/breez/breez-sdk-spark-react-native';
|
|
80
|
+
const androidUrl = `${repo}/releases/download/${version}/android-artifacts.zip`;
|
|
81
|
+
const iosUrl = `${repo}/releases/download/${version}/ios-artifacts.zip`;
|
|
82
|
+
// Download and verify Android artifacts
|
|
83
|
+
try {
|
|
84
|
+
(0, child_process_1.execSync)(`curl -L "${androidUrl}" --output android-artifacts.zip`, {
|
|
85
|
+
cwd: packageRoot,
|
|
86
|
+
stdio: 'inherit',
|
|
87
|
+
});
|
|
88
|
+
const actualAndroidChecksum = (0, child_process_1.execSync)('shasum -a 256 android-artifacts.zip | cut -d" " -f1', { cwd: packageRoot, encoding: 'utf-8' }).trim();
|
|
89
|
+
if (actualAndroidChecksum !== androidChecksum) {
|
|
90
|
+
throw new Error(`Android artifacts checksum mismatch. Expected: ${androidChecksum}, Got: ${actualAndroidChecksum}`);
|
|
91
|
+
}
|
|
92
|
+
(0, child_process_1.execSync)('unzip -o android-artifacts.zip && rm -rf android-artifacts.zip', {
|
|
93
|
+
cwd: packageRoot,
|
|
94
|
+
stdio: 'inherit',
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
(0, child_process_1.execSync)('rm -f android-artifacts.zip', { cwd: packageRoot });
|
|
99
|
+
console.error('Failed to download or verify Android artifacts');
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
// Download and verify iOS artifacts
|
|
103
|
+
try {
|
|
104
|
+
(0, child_process_1.execSync)(`curl -L "${iosUrl}" --output ios-artifacts.zip`, {
|
|
105
|
+
cwd: packageRoot,
|
|
106
|
+
stdio: 'inherit',
|
|
107
|
+
});
|
|
108
|
+
const actualIosChecksum = (0, child_process_1.execSync)('shasum -a 256 ios-artifacts.zip | cut -d" " -f1', { cwd: packageRoot, encoding: 'utf-8' }).trim();
|
|
109
|
+
if (actualIosChecksum !== iosChecksum) {
|
|
110
|
+
throw new Error(`iOS artifacts checksum mismatch. Expected: ${iosChecksum}, Got: ${actualIosChecksum}`);
|
|
111
|
+
}
|
|
112
|
+
(0, child_process_1.execSync)('unzip -o ios-artifacts.zip && rm -rf ios-artifacts.zip', {
|
|
113
|
+
cwd: packageRoot,
|
|
114
|
+
stdio: 'inherit',
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
(0, child_process_1.execSync)('rm -f ios-artifacts.zip', { cwd: packageRoot });
|
|
119
|
+
console.error('Failed to download or verify iOS artifacts');
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function findPackageRoot() {
|
|
124
|
+
let currentDir = __dirname;
|
|
125
|
+
// Walk up the directory tree to find the package root
|
|
126
|
+
while (currentDir !== path.dirname(currentDir)) {
|
|
127
|
+
const packageJsonPath = path.join(currentDir, 'package.json');
|
|
128
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
129
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
130
|
+
if (packageJson.name === '@breeztech/breez-sdk-spark-react-native') {
|
|
131
|
+
return currentDir;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
currentDir = path.dirname(currentDir);
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
package/scripts/postinstall.sh
CHANGED
|
@@ -1,14 +1,52 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
+
set -e
|
|
3
|
+
|
|
2
4
|
# Download prebuilt binary artifacts from the release
|
|
5
|
+
# Skip if running in Expo managed workflow (prebuild will handle it)
|
|
6
|
+
|
|
7
|
+
# Skip if artifacts already exist (they may have been downloaded by the Expo plugin)
|
|
8
|
+
if [ -d "android/src/main/jniLibs" ] && [ -d "build/RnBreezSdkSpark.xcframework" ]; then
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
# Check for explicit skip flag
|
|
13
|
+
if [ -n "$EXPO_PUBLIC_SKIP_POSTINSTALL" ]; then
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
3
17
|
REPO=https://github.com/breez/breez-sdk-spark-react-native
|
|
4
18
|
TAG=$(node -p "require('./package.json').version")
|
|
19
|
+
ANDROID_CHECKSUM=$(node -p "require('./package.json').checksums.android")
|
|
20
|
+
IOS_CHECKSUM=$(node -p "require('./package.json').checksums.ios")
|
|
5
21
|
|
|
22
|
+
# Download and verify Android
|
|
6
23
|
ANDROID_URL=$REPO/releases/download/$TAG/android-artifacts.zip
|
|
7
24
|
curl -L $ANDROID_URL --output android-artifacts.zip
|
|
25
|
+
|
|
26
|
+
ACTUAL_ANDROID=$(shasum -a 256 android-artifacts.zip | cut -d' ' -f1)
|
|
27
|
+
if [ "$ACTUAL_ANDROID" != "$ANDROID_CHECKSUM" ]; then
|
|
28
|
+
echo "Error: Android artifacts checksum mismatch"
|
|
29
|
+
echo "Expected: $ANDROID_CHECKSUM"
|
|
30
|
+
echo "Got: $ACTUAL_ANDROID"
|
|
31
|
+
rm -f android-artifacts.zip
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
8
35
|
unzip -o android-artifacts.zip
|
|
9
36
|
rm -rf android-artifacts.zip
|
|
10
37
|
|
|
38
|
+
# Download and verify iOS
|
|
11
39
|
IOS_URL=$REPO/releases/download/$TAG/ios-artifacts.zip
|
|
12
40
|
curl -L $IOS_URL --output ios-artifacts.zip
|
|
41
|
+
|
|
42
|
+
ACTUAL_IOS=$(shasum -a 256 ios-artifacts.zip | cut -d' ' -f1)
|
|
43
|
+
if [ "$ACTUAL_IOS" != "$IOS_CHECKSUM" ]; then
|
|
44
|
+
echo "Error: iOS artifacts checksum mismatch"
|
|
45
|
+
echo "Expected: $IOS_CHECKSUM"
|
|
46
|
+
echo "Got: $ACTUAL_IOS"
|
|
47
|
+
rm -f ios-artifacts.zip
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
|
|
13
51
|
unzip -o ios-artifacts.zip
|
|
14
52
|
rm -rf ios-artifacts.zip
|