Add cross-platform build system and CI/CD release pipeline
- Add setup.sh (Unix) and setup.bat (Windows) build scripts that detect
platform, check dependencies, and build all components (JS, WASM, miner)
- Add GitHub Actions CI workflow (test on push/PR)
- Add GitHub Actions release workflow that builds static miner binaries
for Linux x86_64/aarch64, macOS Intel/Apple Silicon, and Windows
- Switch miner from OpenSSL to rustls for zero runtime dependencies
- Fix wallet-sync batch fetching (remove broken .bin binary endpoint,
use sequential JSON-RPC get_block calls)
- Add portable storage binary format serializer/deserializer for future
batch RPC support
- Add postBinary() to RPC client for binary endpoint communication
- Update package.json: bun-only runtime, remove node/npm references
This commit is contained in:
@@ -313,6 +313,75 @@ export class RPCClient {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* POST binary data (portable storage format) and parse binary response
|
||||
* @param {string} endpoint - API endpoint path
|
||||
* @param {Uint8Array} body - Binary request body
|
||||
* @returns {Promise<RPCResponse>}
|
||||
*/
|
||||
async postBinary(endpoint, body) {
|
||||
let lastError = null;
|
||||
const attempts = this.retries + 1;
|
||||
|
||||
for (let attempt = 1; attempt <= attempts; attempt++) {
|
||||
try {
|
||||
const url = endpoint.startsWith('/')
|
||||
? `${this.url}${endpoint}`
|
||||
: `${this.url}/${endpoint}`;
|
||||
|
||||
const response = await this._fetchWithTimeout(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
...this._buildHeaders(),
|
||||
'Content-Type': 'application/octet-stream'
|
||||
},
|
||||
body
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
if (response.status === 401) {
|
||||
return {
|
||||
success: false,
|
||||
error: {
|
||||
code: RPC_ERROR_CODES.AUTHENTICATION_ERROR,
|
||||
message: 'Authentication failed'
|
||||
}
|
||||
};
|
||||
}
|
||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
|
||||
const arrayBuffer = await response.arrayBuffer();
|
||||
return {
|
||||
success: true,
|
||||
result: new Uint8Array(arrayBuffer)
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
if (error.name === 'AbortError') {
|
||||
lastError = {
|
||||
code: RPC_ERROR_CODES.TIMEOUT_ERROR,
|
||||
message: `Request timed out after ${this.timeout}ms`
|
||||
};
|
||||
} else {
|
||||
lastError = {
|
||||
code: RPC_ERROR_CODES.NETWORK_ERROR,
|
||||
message: error.message || 'Network error'
|
||||
};
|
||||
}
|
||||
|
||||
if (attempt < attempts) {
|
||||
await this._sleep(this.retryDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
success: false,
|
||||
error: lastError
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a raw HTTP GET request
|
||||
* @param {string} endpoint - API endpoint path
|
||||
|
||||
Reference in New Issue
Block a user