@desig/web3
Version:
Desig: The Blockchain-Agnostic Multisig Solution
27 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.addSolTransaction = exports.toSolanaAddress = exports.isSolanaAddress = void 0;
const web3_js_1 = require("@solana/web3.js");
const isSolanaAddress = (address) => {
if (!address)
return false;
try {
const publicKey = new web3_js_1.PublicKey(address);
if (!publicKey)
throw new Error('Invalid public key');
return true;
}
catch (er) {
return false;
}
};
exports.isSolanaAddress = isSolanaAddress;
var supported_chains_1 = require("@desig/supported-chains");
Object.defineProperty(exports, "toSolanaAddress", { enumerable: true, get: function () { return supported_chains_1.toSolanaAddress; } });
const addSolTransaction = (transaction, { sig, addr }) => {
const pubkey = new web3_js_1.PublicKey(addr);
transaction.addSignature(pubkey, Buffer.from(sig));
return transaction;
};
exports.addSolTransaction = addSolTransaction;
//# sourceMappingURL=sol.js.map