sei-agent-kit
Version:
A package for building AI agents on the SEI blockchain
64 lines • 2.84 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSymphony = createSymphony;
// This function creates a Symphony instance with proper dynamic imports
async function createSymphony(options) {
try {
// Using dynamic import to handle ESM modules
// We need to use a more specific approach for CommonJS compatibility
let Symphony;
try {
// Try direct dynamic import first
const symphonyImport = await Promise.resolve().then(() => __importStar(require('symphony-sdk/viem')));
Symphony = symphonyImport.Symphony;
}
catch (importError) {
// If that fails, use a different approach
console.error('Failed to import Symphony with dynamic import, trying alternative:', importError);
// Load as a module using Function constructor to evaluate the import
// This is a workaround for CommonJS environments
const importFunc = new Function('modulePath', 'return import(modulePath)');
const symphonyImport = await importFunc('symphony-sdk/viem');
Symphony = symphonyImport.Symphony;
}
return new Symphony(options);
}
catch (error) {
console.error('Error importing Symphony:', error);
throw new Error('Failed to load Symphony SDK: ' + (error instanceof Error ? error.message : String(error)));
}
}
//# sourceMappingURL=symphony-wrapper.js.map