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);
|
||||
|
||||
// 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);
|
||||
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");
|
||||
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");
|
||||
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);
|
||||
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);
|
||||
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" } };
|
||||
}
|
||||
|
||||
export function get_health_status() {
|
||||
function get_health_status() {
|
||||
console.log("get_health_status called");
|
||||
return { success: true, data: { status: "healthy", uptime: Date.now() } };
|
||||
}
|
||||
|
||||
// Export all the types and interfaces
|
||||
export const AnkFlag = {
|
||||
const AnkFlag = {
|
||||
VALIDATION_YES: "validation_yes",
|
||||
VALIDATION_NO: "validation_no"
|
||||
};
|
||||
|
||||
export const ProcessState = {
|
||||
const ProcessState = {
|
||||
DRAFT: "draft",
|
||||
ACTIVE: "active",
|
||||
COMPLETED: "completed",
|
||||
CANCELLED: "cancelled"
|
||||
};
|
||||
|
||||
export const MemberRole = {
|
||||
const MemberRole = {
|
||||
OWNER: "owner",
|
||||
ADMIN: "admin",
|
||||
MEMBER: "member",
|
||||
GUEST: "guest"
|
||||
};
|
||||
|
||||
export const ValidationRuleType = {
|
||||
const ValidationRuleType = {
|
||||
REQUIRED: "required",
|
||||
MIN_LENGTH: "min_length",
|
||||
MAX_LENGTH: "max_length",
|
||||
@ -291,13 +291,13 @@ export const ValidationRuleType = {
|
||||
};
|
||||
|
||||
// Initialize the WASM module
|
||||
export function init() {
|
||||
function init() {
|
||||
console.log("sdk_client WASM stub initialized (flate2 compatible)");
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// Default export
|
||||
export default {
|
||||
// Module exports for CommonJS
|
||||
module.exports = {
|
||||
init,
|
||||
create_transaction,
|
||||
create_silent_payment_address,
|
||||
|
Loading…
x
Reference in New Issue
Block a user