@across-protocol/sdk 4.1.24 → 4.1.25-beta.1

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,11 +1,12 @@
1
1
  {
2
2
  "name": "@across-protocol/sdk",
3
3
  "author": "UMA Team",
4
- "version": "4.1.24",
4
+ "version": "4.1.25-beta.1",
5
5
  "license": "AGPL-3.0",
6
6
  "homepage": "https://docs.across.to/reference/sdk",
7
7
  "files": [
8
8
  "dist",
9
+ "scripts",
9
10
  "src"
10
11
  ],
11
12
  "engines": {
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Build Script for bigint-buffer Native Module
3
+ *
4
+ * Purpose:
5
+ * This script handles the native compilation of the bigint-buffer module, which provides
6
+ * high-performance BigInt <-> Buffer conversions using native C++ code.
7
+ *
8
+ * Why JavaScript and not TypeScript or an embedded shell script:
9
+ * 1. This is a build script that runs during package installation (postinstall)
10
+ * 2. Using TypeScript would require the TypeScript compiler or ts-node to be available during installation
11
+ * 3. Plain JavaScript ensures this script can run immediately without compilation
12
+ * 4. This script is operating system agnostic, so it can be run on any platform that supports Node.js
13
+ */
14
+
15
+ const { execSync } = require('child_process');
16
+ const { existsSync } = require('fs');
17
+ const path = require('path');
18
+
19
+ try {
20
+ // Check if the bigint-buffer module exists in node_modules
21
+ // Using path.join for cross-platform compatibility (Windows/Unix)
22
+ const bigintBufferPath = path.join(process.cwd(), 'node_modules/bigint-buffer');
23
+
24
+ // Skip if module isn't installed
25
+ if (!existsSync(bigintBufferPath)) {
26
+ console.log('Skipping bigint-buffer build: folder not found');
27
+ process.exit(0);
28
+ }
29
+
30
+ // Verify node-gyp (native module build tool) is available
31
+ // node-gyp is required to compile the C++ code in bigint-buffer
32
+ try {
33
+ execSync('command -v node-gyp', { stdio: 'ignore' });
34
+ } catch {
35
+ console.log('Skipping bigint-buffer build: node-gyp not found');
36
+ process.exit(0);
37
+ }
38
+
39
+ // Change to the module directory and run the native build
40
+ // node-gyp configure: Creates platform-specific build files
41
+ // node-gyp build: Compiles the native code
42
+ process.chdir(bigintBufferPath);
43
+ execSync('node-gyp configure', { stdio: 'inherit' });
44
+ execSync('node-gyp build', { stdio: 'inherit' });
45
+ } catch (error) {
46
+ // Proper error handling for build failures
47
+ console.error('Error building bigint-buffer:', error);
48
+ process.exit(1);
49
+ }