@lucoadam/zebec-wormhole-sdk
Version:
This sdk can be use to transfer assets across chains and to interact with the Zebec's xchain bridge smart contracts for passing message from EVM chain to solana specially to utilize the features of Zebec Streaming and Zebec Multisig Streaming protocol.
26 lines (25 loc) • 796 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isValidAddress = isValidAddress;
var _wormholeSdk = require("@certusone/wormhole-sdk");
var _web = require("@solana/web3.js");
var _ethers = require("ethers");
var _constants = require("./constants");
var _errors = require("./errors");
function isValidAddress(tokenAddress, sourceChain) {
if ((0, _wormholeSdk.isEVMChain)(sourceChain)) {
return _ethers.ethers.utils.isAddress(tokenAddress);
} else if ((0, _constants.isSolanaChain)((0, _wormholeSdk.toChainId)(sourceChain))) {
try {
const _ = new _web.PublicKey(tokenAddress);
return true;
} catch (e) {
return false;
}
} else {
throw new _errors.NotImplementedError();
}
}
//# sourceMappingURL=validation.js.map