oken-waas
Version:
Oken Wallet as a Service SDK
54 lines • 2.25 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const wallets_1 = __importDefault(require("./src/wallets"));
const contracts_1 = __importDefault(require("./src/contracts"));
const transactions_1 = __importDefault(require("./src/transactions"));
const endpoints_1 = __importDefault(require("./src/config/endpoints"));
const networks_1 = __importDefault(require("./src/config/networks"));
const typed_data_1 = __importDefault(require("./src/typed_data"));
const okenSigner_1 = __importDefault(require("./src/components/okenSigner"));
const api_1 = __importDefault(require("./src/components/api"));
const errorHandler_1 = __importDefault(require("./src/components/errorHandler"));
exports.default = {
/**
* @dev Connect to the Oken API
* @param config
* @returns oken instance
*/
connect: ({ endpoint, network, okenClientId, privateKey, signer = okenSigner_1.default, signerOptions, alchemyKey }) => {
if (!endpoint)
throw Error('Missing endpoint');
if (!network)
throw Error('Missing network');
if (!okenClientId)
throw Error('Missing okenClientId');
if (!privateKey)
throw Error('Missing privateKey');
let alchemyConfig;
if (alchemyKey)
alchemyConfig = { alchemyKey, network };
const api = (0, api_1.default)(endpoint, signer(okenClientId, privateKey, signerOptions), alchemyConfig);
return {
wallets: (0, wallets_1.default)(api, network),
contracts: (0, contracts_1.default)(api, network),
transactions: (0, transactions_1.default)(api),
errors: errorHandler_1.default
};
},
/**
* @dev List of available networks
*/
networks: networks_1.default,
/**
* @dev List of available environments
*/
endpoints: endpoints_1.default,
/**
* @dev Collection of some typed data structures. You can use your own typed data structures when signing v4 messages
*/
typedData: typed_data_1.default
};
//# sourceMappingURL=index.js.map