@ledgerhq/coin-aptos
Version:
Ledger Aptos Coin integration
44 lines • 2.05 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createApi = void 0;
const config_1 = __importDefault(require("../config"));
const network_1 = require("../network");
const combine_1 = require("../logic/combine");
const craftTransaction_1 = require("../logic/craftTransaction");
const getBalances_1 = require("../logic/getBalances");
function createApi(config) {
config_1.default.setCoinConfig(() => ({ ...config, status: { type: "active" } }));
const client = new network_1.AptosAPI(config.aptosSettings);
return {
broadcast: (tx) => client.broadcast(tx),
combine: (tx, signature, pubkey) => (0, combine_1.combine)(tx, signature, pubkey),
craftTransaction: (transactionIntent, _customFees) => (0, craftTransaction_1.craftTransaction)(client, transactionIntent),
craftRawTransaction: (_transaction, _sender, _publicKey, _sequence) => {
throw new Error("craftRawTransaction is not supported");
},
estimateFees: (transactionIntent) => client.estimateFees(transactionIntent),
getBalance: (address) => (0, getBalances_1.getBalances)(client, address),
lastBlock: () => client.getLastBlock(),
listOperations: (address, pagination) => client.listOperations(address, pagination.minHeight),
getBlock(_height) {
throw new Error("getBlock is not supported");
},
getBlockInfo(_height) {
throw new Error("getBlockInfo is not supported");
},
getStakes(_address, _cursor) {
throw new Error("getStakes is not supported");
},
getRewards(_address, _cursor) {
throw new Error("getRewards is not supported");
},
getValidators(_cursor) {
throw new Error("getValidators is not supported");
},
};
}
exports.createApi = createApi;
//# sourceMappingURL=index.js.map