fix: Convert ES6 exports to CommonJS for Node.js compatibility
- Replace all 'export function' with 'function' declarations - Replace 'export const' with 'const' declarations - Add 'module.exports' for CommonJS compatibility - Fix ES modules vs CommonJS incompatibility causing sdk_signer startup failure
This commit is contained in:
parent
7e2d69d139
commit
01b464728f
@ -9,27 +9,27 @@ const deflateAsync = promisify(deflate);
|
|||||||
const inflateAsync = promisify(inflate);
|
const inflateAsync = promisify(inflate);
|
||||||
|
|
||||||
// Stub implementations for all SDK functions
|
// Stub implementations for all SDK functions
|
||||||
export function create_transaction(addresses, amount) {
|
function create_transaction(addresses, amount) {
|
||||||
console.log("create_transaction called with addresses:", addresses, "amount:", amount);
|
console.log("create_transaction called with addresses:", addresses, "amount:", amount);
|
||||||
return { success: true, data: { txid: "stub_txid_flate2" } };
|
return { success: true, data: { txid: "stub_txid_flate2" } };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function create_silent_payment_address(scan_key, spend_key) {
|
function create_silent_payment_address(scan_key, spend_key) {
|
||||||
console.log("create_silent_payment_address called");
|
console.log("create_silent_payment_address called");
|
||||||
return { success: true, data: "stub_sp_address_flate2" };
|
return { success: true, data: "stub_sp_address_flate2" };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function create_silent_payment_transaction(scan_key, spend_key, outputs) {
|
function create_silent_payment_transaction(scan_key, spend_key, outputs) {
|
||||||
console.log("create_silent_payment_transaction called");
|
console.log("create_silent_payment_transaction called");
|
||||||
return { success: true, data: { txid: "stub_sp_txid_flate2" } };
|
return { success: true, data: { txid: "stub_sp_txid_flate2" } };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function create_device(name, description) {
|
function create_device(name, description) {
|
||||||
console.log("create_device called with name:", name, "description:", description);
|
console.log("create_device called with name:", name, "description:", description);
|
||||||
return { success: true, data: { id: "stub_device_id_flate2", name, description } };
|
return { success: true, data: { id: "stub_device_id_flate2", name, description } };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function get_device(id) {
|
function get_device(id) {
|
||||||
console.log("get_device called with id:", id);
|
console.log("get_device called with id:", id);
|
||||||
return { success: true, data: { id, name: "stub_device", description: "stub_description" } };
|
return { success: true, data: { id, name: "stub_device", description: "stub_description" } };
|
||||||
}
|
}
|
||||||
@ -257,32 +257,32 @@ export function get_version() {
|
|||||||
return { success: true, data: { version: "0.1.4-flate2-stub" } };
|
return { success: true, data: { version: "0.1.4-flate2-stub" } };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function get_health_status() {
|
function get_health_status() {
|
||||||
console.log("get_health_status called");
|
console.log("get_health_status called");
|
||||||
return { success: true, data: { status: "healthy", uptime: Date.now() } };
|
return { success: true, data: { status: "healthy", uptime: Date.now() } };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export all the types and interfaces
|
// Export all the types and interfaces
|
||||||
export const AnkFlag = {
|
const AnkFlag = {
|
||||||
VALIDATION_YES: "validation_yes",
|
VALIDATION_YES: "validation_yes",
|
||||||
VALIDATION_NO: "validation_no"
|
VALIDATION_NO: "validation_no"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ProcessState = {
|
const ProcessState = {
|
||||||
DRAFT: "draft",
|
DRAFT: "draft",
|
||||||
ACTIVE: "active",
|
ACTIVE: "active",
|
||||||
COMPLETED: "completed",
|
COMPLETED: "completed",
|
||||||
CANCELLED: "cancelled"
|
CANCELLED: "cancelled"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MemberRole = {
|
const MemberRole = {
|
||||||
OWNER: "owner",
|
OWNER: "owner",
|
||||||
ADMIN: "admin",
|
ADMIN: "admin",
|
||||||
MEMBER: "member",
|
MEMBER: "member",
|
||||||
GUEST: "guest"
|
GUEST: "guest"
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ValidationRuleType = {
|
const ValidationRuleType = {
|
||||||
REQUIRED: "required",
|
REQUIRED: "required",
|
||||||
MIN_LENGTH: "min_length",
|
MIN_LENGTH: "min_length",
|
||||||
MAX_LENGTH: "max_length",
|
MAX_LENGTH: "max_length",
|
||||||
@ -291,13 +291,13 @@ export const ValidationRuleType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Initialize the WASM module
|
// Initialize the WASM module
|
||||||
export function init() {
|
function init() {
|
||||||
console.log("sdk_client WASM stub initialized (flate2 compatible)");
|
console.log("sdk_client WASM stub initialized (flate2 compatible)");
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default export
|
// Module exports for CommonJS
|
||||||
export default {
|
module.exports = {
|
||||||
init,
|
init,
|
||||||
create_transaction,
|
create_transaction,
|
||||||
create_silent_payment_address,
|
create_silent_payment_address,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user