diff --git a/README.md b/README.md index 7d3a444b..820a820c 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ And for transfer NEON from Neon EVM to Solana, you should known token contract a ```javascript const tokenContract = NEON_TRANSFER_CONTRACT_DEVNET; // or SOL_TRANSFER_CONTRACT_DEVNET -const transaction = await neonNeonWeb3Transaction(web3, neonWallet, tokenContract, solanaWallet, amount); // Neon EVM Transaction object +const transaction = await neonNeonTransactionWeb3(web3, neonWallet, tokenContract, solanaWallet, amount); // Neon EVM Transaction object const hash = await sendNeonTransaction(web3, transaction, neonWallet); // method for sign and send transaction to network ``` @@ -109,7 +109,7 @@ transaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash; const signature = await sendSolanaTransaction(connection, transaction, [signer], true, { skipPreflight: false }); ``` -And for transfer ERC20 tokens from Neon EVM to Solana: +And for transfer ERC20 tokens from Neon EVM to Solana: ```javascript const token = tokenList[0]; @@ -117,7 +117,7 @@ const mintPubkey = new PublicKey(token.address_spl); const associatedToken = getAssociatedTokenAddressSync(mintPubkey, solanaWallet); const solanaTransaction = createMintSolanaTransaction(solanaWallet, mintPubkey, associatedToken, proxyStatus); solanaTransaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash; -const neonTransaction = await createMintNeonWeb3Transaction(web3, neonWallet.address, associatedToken, token, amount); +const neonTransaction = await createMintNeonTransactionWeb3(web3, neonWallet.address, associatedToken, token, amount); const signedSolanaTransaction = await sendSolanaTransaction(connection, solanaTransaction, [signer], true, { skipPreflight: false }); const signedNeonTransaction = await sendNeonTransaction(web3, neonTransaction, neonWallet); ``` diff --git a/dist/api/index.js.map b/dist/api/index.js.map deleted file mode 100644 index 2d3aee17..00000000 --- a/dist/api/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"} \ No newline at end of file diff --git a/dist/api/neon-proxy-rpc.js b/dist/api/neon-proxy-rpc.js deleted file mode 100644 index 13376f6e..00000000 --- a/dist/api/neon-proxy-rpc.js +++ /dev/null @@ -1,38 +0,0 @@ -export class NeonProxyRpcApi { - constructor(params) { - this.neonProxyRpcApi = ''; - this.solanaRpcApi = ''; - this.neonProxyRpcApi = params.neonProxyRpcApi ?? ''; - this.solanaRpcApi = params.solanaRpcApi ?? ''; - } - async rpc(url, method, params = []) { - const id = Date.now(); - const body = { id, jsonrpc: '2.0', method, params }; - console.log('POST', url, JSON.stringify(body)); - const response = await fetch(url, { - method: 'POST', - mode: 'cors', - body: JSON.stringify(body) - }); - return await response.json(); - } - async proxy(method, params = []) { - return this.rpc(this.neonProxyRpcApi, method, params); - } - async solana(method, params = []) { - return this.rpc(this.solanaRpcApi, method, params); - } - async neonEmulate(params = []) { - return this.proxy('neon_emulate', params).then(d => d.result); - } - async evmParams() { - return this.proxy('neon_getEvmParams', []).then(d => d.result); - } - async gasTokenList() { - return this.proxy('neon_getGasTokenList', []).then(d => d.result); - } - async nativeTokenList() { - return this.proxy('neon_getNativeTokenList', []).then(d => d.result); - } -} -//# sourceMappingURL=neon-proxy-rpc.js.map \ No newline at end of file diff --git a/dist/api/neon-proxy-rpc.js.map b/dist/api/neon-proxy-rpc.js.map deleted file mode 100644 index 31cc6c1e..00000000 --- a/dist/api/neon-proxy-rpc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"neon-proxy-rpc.js","sourceRoot":"","sources":["../../src/api/neon-proxy-rpc.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,eAAe;IAI1B,YAAY,MAAyB;QAHrC,oBAAe,GAAG,EAAE,CAAC;QACrB,iBAAY,GAAG,EAAE,CAAC;QAGhB,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC;QACpD,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,GAAG,CAAI,GAAW,EAAE,MAAc,E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K,CAAa,sBAAsB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,IAAI,CAAC,KAAK,CAAa,yBAAyB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACnF,CAAC;CACF"} \ No newline at end of file diff --git a/dist/cjs/api/index.js b/dist/cjs/api/index.js new file mode 100644 index 00000000..9da65610 --- /dev/null +++ b/dist/cjs/api/index.js @@ -0,0 +1,17 @@ +"use strict"; +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./neon-proxy-rpc"), exports); diff --git a/dist/cjs/api/neon-proxy-rpc.js b/dist/cjs/api/neon-proxy-rpc.js new file mode 100644 index 00000000..f1cdd04d --- /dev/null +++ b/dist/cjs/api/neon-proxy-rpc.js @@ -0,0 +1,65 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NeonProxyRpcApi = void 0; +class NeonProxyRpcApi { + constructor(params) { + var _a, _b; + this.neonProxyRpcApi = ''; + this.solanaRpcApi = ''; + this.neonProxyRpcApi = (_a = params.neonProxyRpcApi) !== null && _a !== void 0 ? _a : ''; + this.solanaRpcApi = (_b = params.solanaRpcApi) !== null && _b !== void 0 ? _b : ''; + } + rpc(url, method, params = []) { + return __awaiter(this, void 0, void 0, function* () { + const id = Date.now(); + const body = { id, jsonrpc: '2.0', method, params }; + console.log('POST', url, JSON.stringify(body)); + const response = yield fetch(url, { + method: 'POST', + mode: 'cors', + body: JSON.stringify(body) + }); + return yield response.json(); + }); + } + proxy(method, params = []) { + return __awaiter(this, void 0, void 0, function* () { + return this.rpc(this.neonProxyRpcApi, method, params); + }); + } + solana(method, params = []) { + return __awaiter(this, void 0, void 0, function* () { + return this.rpc(this.solanaRpcApi, method, params); + }); + } + neonEmulate(params = []) { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_emulate', params).then(d => d.result); + }); + } + evmParams() { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_getEvmParams', []).then(d => d.result); + }); + } + gasTokenList() { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_getGasTokenList', []).then(d => d.result); + }); + } + nativeTokenList() { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_getNativeTokenList', []).then(d => d.result); + }); + } +} +exports.NeonProxyRpcApi = NeonProxyRpcApi; diff --git a/dist/cjs/core/deprecated/InstructionService.js b/dist/cjs/core/deprecated/InstructionService.js new file mode 100644 index 00000000..32541ef2 --- /dev/null +++ b/dist/cjs/core/deprecated/InstructionService.js @@ -0,0 +1,112 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.InstructionService = void 0; +const web3_js_1 = require("@solana/web3.js"); +const spl_token_1 = require("@solana/spl-token"); +const utils_1 = require("../../utils"); +const data_1 = require("../../data"); +const utils_2 = require("../utils"); +const mint_transfer_1 = require("../mint-transfer"); +const noop = new Function(); +/** + * @deprecated this code was deprecated and will remove in next releases. + * Please use other methods from mint-transfer.ts and neon-transfer.ts files + * For more examples see `examples` folder + */ +class InstructionService { + get programId() { + return new web3_js_1.PublicKey(this.proxyStatus.NEON_EVM_ID); + } + get tokenMint() { + var _a; + return new web3_js_1.PublicKey((_a = this.proxyStatus.NEON_TOKEN_MINT) !== null && _a !== void 0 ? _a : data_1.NEON_TOKEN_MINT_DEVNET); + } + constructor(options) { + var _a; + this.emitFunction = (functionName, ...args) => { + if (typeof functionName === 'function') { + functionName(...args); + } + }; + this.web3 = options.web3; + this.proxyApi = options.proxyApi; + this.proxyStatus = options.proxyStatus; + this.solanaWalletAddress = options.solanaWalletAddress || ''; + this.neonWalletAddress = options.neonWalletAddress || ''; + this.neonContractAddress = options.neonContractAddress || ''; + this.connection = options.connection; + this.solanaOptions = (_a = options.solanaOptions) !== null && _a !== void 0 ? _a : { skipPreflight: false }; + this.events = { + onBeforeCreateInstruction: options.onBeforeCreateInstruction || noop, + onCreateNeonAccountInstruction: options.onCreateNeonAccountInstruction || noop, + onBeforeSignTransaction: options.onBeforeSignTransaction || noop, + onBeforeNeonSign: options.onBeforeNeonSign || noop, + onSuccessSign: options.onSuccessSign || noop, + onErrorSign: options.onErrorSign || noop + }; + } + get erc20ForSPLContract() { + return new this.web3.eth.Contract(data_1.erc20Abi); + } + get neonWrapperContract() { + return new this.web3.eth.Contract(data_1.neonWrapperAbi); + } + neonWrapper2Contract(address) { + return new this.web3.eth.Contract(data_1.neonWrapper2Abi, address); + } + get solana() { + if ('solana' in window) { + return window['solana']; + } + return {}; + } + get solanaWalletPubkey() { + return new web3_js_1.PublicKey(this.solanaWalletAddress); + } + get solanaWalletSigner() { + return (0, utils_2.solanaWalletSigner)(this.web3, this.solanaWalletPubkey, this.neonWalletAddress); + } + neonAccountAddress(neonWallet) { + return (0, utils_2.neonWalletProgramAddress)(neonWallet, this.programId); + } + authAccountAddress(neonWallet, token) { + return (0, utils_2.authAccountAddress)(neonWallet, this.programId, token); + } + getNeonAccount(neonAssociatedKey) { + return __awaiter(this, void 0, void 0, function* () { + return this.connection.getAccountInfo(neonAssociatedKey); + }); + } + createAccountV3Instruction(solanaWallet, neonWalletPDA, neonWallet) { + return (0, mint_transfer_1.createAccountV3Instruction)(solanaWallet, neonWalletPDA, this.programId, neonWallet); + } + getAssociatedTokenAddress(mintPubkey, walletPubkey) { + return (0, spl_token_1.getAssociatedTokenAddressSync)(mintPubkey, walletPubkey); + } + approveDepositInstruction(walletPubkey, neonPDAPubkey, associatedTokenPubkey, amount) { + return (0, spl_token_1.createApproveInstruction)(associatedTokenPubkey, neonPDAPubkey, walletPubkey, amount); + } + createApproveSolanaData(solanaWallet, splToken, amount) { + const fullAmount = (0, utils_1.toFullAmount)(amount, splToken.decimals); + return this.erc20ForSPLContract.methods.approveSolana(solanaWallet.toBuffer(), fullAmount).encodeABI(); + } + ethereumTransaction(amount, token) { + const solanaWallet = this.solanaWalletPubkey; + return { + to: token.address, + from: this.neonWalletAddress, + value: '0x00', + data: this.createApproveSolanaData(solanaWallet, token, amount) + }; + } +} +exports.InstructionService = InstructionService; diff --git a/dist/cjs/core/deprecated/MintPortal.js b/dist/cjs/core/deprecated/MintPortal.js new file mode 100644 index 00000000..fe088e23 --- /dev/null +++ b/dist/cjs/core/deprecated/MintPortal.js @@ -0,0 +1,130 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MintPortal = void 0; +const spl_token_1 = require("@solana/spl-token"); +const web3_js_1 = require("@solana/web3.js"); +const utils_1 = require("../../utils"); +const mint_transfer_1 = require("../mint-transfer"); +const utils_2 = require("../utils"); +const InstructionService_1 = require("./InstructionService"); +/** + * @deprecated this code was deprecated and will remove in next releases. + * Please use other methods in mint-transfer.ts file + * For more examples see `examples` folder + */ +class MintPortal extends InstructionService_1.InstructionService { + // Solana -> Neon + createNeonTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + this.emitFunction(events.onBeforeCreateInstruction); + const transaction = yield this.neonTransferTransaction(amount, splToken); + this.emitFunction(events.onBeforeSignTransaction); + try { + const signedTransaction = yield this.solana.signTransaction(transaction); + const signature = yield this.connection.sendRawTransaction(signedTransaction.serialize(), this.solanaOptions); + this.emitFunction(events.onSuccessSign, signature); + } + catch (e) { + this.emitFunction(events.onErrorSign, e); + } + }); + } + // Neon -> Solana + createSolanaTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + const mintPubkey = new web3_js_1.PublicKey(splToken.address_spl); + const walletPubkey = this.solanaWalletPubkey; + const associatedTokenPubkey = (0, spl_token_1.getAssociatedTokenAddressSync)(mintPubkey, walletPubkey); + const solanaTransaction = yield this.solanaTransferTransaction(walletPubkey, mintPubkey, associatedTokenPubkey); + const neonTransaction = yield this.createNeonTransaction(this.neonWalletAddress, associatedTokenPubkey, splToken, amount); + neonTransaction.nonce = yield this.web3.eth.getTransactionCount(this.neonWalletAddress); + this.emitFunction(events.onBeforeSignTransaction); + try { + const signedSolanaTransaction = yield this.solana.signTransaction(solanaTransaction); + const signature = yield this.connection.sendRawTransaction(signedSolanaTransaction.serialize(), this.solanaOptions); + const { transactionHash } = yield this.web3.eth.sendTransaction(neonTransaction); + this.emitFunction(events.onSuccessSign, signature, transactionHash); + } + catch (error) { + this.emitFunction(events.onErrorSign, error); + } + }); + } + neonTransferTransaction(amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const fullAmount = (0, utils_1.toFullAmount)(amount, splToken.decimals); + const walletSigner = yield (0, utils_2.solanaWalletSigner)(this.web3, this.solanaWalletPubkey, this.neonWalletAddress); + const associatedTokenAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(splToken.address_spl), this.solanaWalletPubkey); + const climeData = (0, mint_transfer_1.climeTransactionDataWeb3)(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); + const signedTransaction = yield (0, mint_transfer_1.neonClaimTransactionFromSigner)(climeData, walletSigner, this.neonWalletAddress, splToken); + const { neonKeys, legacyAccounts } = yield (0, mint_transfer_1.createClaimInstruction)(this.proxyApi, signedTransaction); + const transaction = yield (0, mint_transfer_1.neonTransferMintTransaction)(this.connection, this.proxyStatus, this.programId, this.solanaWalletPubkey, this.neonWalletAddress, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, 111); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } + computeBudgetUtilsInstruction(programId) { + return (0, mint_transfer_1.createComputeBudgetUtilsInstruction)(programId, this.proxyStatus); + } + computeBudgetHeapFrameInstruction(programId) { + return (0, mint_transfer_1.createComputeBudgetHeapFrameInstruction)(programId, this.proxyStatus); + } + createClaimInstruction(owner, from, to, splToken, emulateSigner, amount) { + return __awaiter(this, void 0, void 0, function* () { + const nonce = yield this.web3.eth.getTransactionCount(emulateSigner.address); + const fullAmount = (0, utils_1.toFullAmount)(amount, splToken.decimals); + const associatedTokenAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(splToken.address_spl), this.solanaWalletAddress); + const climeData = (0, mint_transfer_1.climeTransactionDataWeb3)(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); + const walletSigner = yield (0, utils_2.solanaWalletSigner)(this.web3, this.solanaWalletAddress, this.neonWalletAddress); + const signedTransaction = yield (0, mint_transfer_1.neonClaimTransactionFromSigner)(climeData, walletSigner, this.neonWalletAddress, splToken); + const { neonKeys, neonTransaction } = yield (0, mint_transfer_1.createClaimInstruction)(this.proxyApi, signedTransaction); + return { neonKeys, neonTransaction: signedTransaction, emulateSigner, nonce }; + }); + } + makeTrExecFromDataIx(neonAddress, neonRawTransaction, neonKeys) { + return (0, mint_transfer_1.createExecFromDataInstruction)(this.solanaWalletPubkey, neonAddress, this.programId, neonRawTransaction, neonKeys, this.proxyStatus); + } + getCollateralPoolAddress(collateralPoolIndex) { + return (0, utils_2.collateralPoolAddress)(this.programId, collateralPoolIndex); + } + createNeonTransaction(neonWallet, solanaWallet, splToken, amount) { + return __awaiter(this, void 0, void 0, function* () { + return (0, mint_transfer_1.createMintNeonTransactionWeb3)(this.web3, neonWallet, solanaWallet, splToken, amount); + }); + } + solanaTransferTransaction(walletPubkey, mintPubkey, associatedTokenPubkey) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = (0, mint_transfer_1.createMintSolanaTransaction)(walletPubkey, mintPubkey, associatedTokenPubkey, this.proxyStatus); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } + // #region Neon -> Solana + createAssociatedTokenAccountInstruction(associatedProgramId, programId, mint, associatedAccount, owner, payer) { + return (0, spl_token_1.createAssociatedTokenAccountInstruction)(mint, associatedAccount, owner, payer); + } + wrapSOLTransaction(amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = yield (0, mint_transfer_1.createWrapSOLTransaction)(this.connection, this.solanaWalletPubkey, amount, splToken); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } + unwrapSOLTransaction(amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = yield (0, mint_transfer_1.createUnwrapSOLTransaction)(this.connection, this.solanaWalletPubkey, splToken); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } +} +exports.MintPortal = MintPortal; diff --git a/dist/cjs/core/deprecated/NeonPortal.js b/dist/cjs/core/deprecated/NeonPortal.js new file mode 100644 index 00000000..f3d0b823 --- /dev/null +++ b/dist/cjs/core/deprecated/NeonPortal.js @@ -0,0 +1,98 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NeonPortal = void 0; +const InstructionService_1 = require("./InstructionService"); +const neon_transfer_1 = require("../neon-transfer"); +const utils_1 = require("../utils"); +/** + * @deprecated this code was deprecated and will remove in next releases. + * Please use other methods in neon-transfer.ts file + * For more examples see `examples` folder + */ +class NeonPortal extends InstructionService_1.InstructionService { + // Solana -> Neon + createNeonTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + this.emitFunction(events.onBeforeCreateInstruction); + const transaction = yield this.neonTransferTransaction(amount, splToken); + this.emitFunction(events.onBeforeSignTransaction); + try { + const signedTransaction = yield this.solana.signTransaction(transaction); + const signature = yield this.connection.sendRawTransaction(signedTransaction.serialize(), this.solanaOptions); + this.emitFunction(events.onSuccessSign, signature); + } + catch (error) { + this.emitFunction(events.onErrorSign, error); + } + }); + } + // Neon -> Solana + createSolanaTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + this.emitFunction(events.onBeforeCreateInstruction); + const transaction = this.ethereumTransaction(amount, splToken); + this.emitFunction(events.onBeforeSignTransaction); + try { + const neonTransaction = yield this.web3.eth.sendTransaction(transaction); + this.emitFunction(events.onSuccessSign, undefined, neonTransaction.transactionHash); + } + catch (error) { + this.emitFunction(events.onErrorSign, error); + } + }); + } + neonTransferTransaction(amount, token, serviceWallet, rewardAmount) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = yield (0, neon_transfer_1.solanaNEONTransferTransaction)(this.solanaWalletPubkey, this.neonWalletAddress, this.programId, this.tokenMint, token, amount, 111, serviceWallet, rewardAmount); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash('finalized')).blockhash; + return transaction; + }); + } + createDepositInstruction(solanaPubkey, neonPubkey, depositPubkey, neonWalletAddress, serviceWallet) { + return (0, neon_transfer_1.createNeonDepositInstruction)(solanaPubkey, neonPubkey, depositPubkey, neonWalletAddress, this.programId, this.tokenMint, serviceWallet); + } + neonTransferInstruction(solanaWallet, serviceWallet, rewardAmount) { + return (0, neon_transfer_1.createNeonTransferInstruction)(this.tokenMint, solanaWallet, serviceWallet, rewardAmount); + } + getAuthorityPoolAddress() { + return (0, utils_1.authorityPoolAddress)(this.programId); + } + createWithdrawEthTransactionData() { + return (0, neon_transfer_1.neonTransactionDataWeb3)(this.web3, this.solanaWalletPubkey); + } + ethereumTransaction(amount, token) { + const from = this.neonWalletAddress; + const to = this.neonContractAddress; + const value = `0x${BigInt(this.web3.utils.toWei(amount.toString(), 'ether')).toString(16)}`; + const data = this.createWithdrawEthTransactionData(); + return { from, to, value, data }; + } + createWithdrawWNeonTransaction(amount, address) { + const contract = this.neonWrapper2Contract(address); + return contract.methods.withdraw(amount).encodeABI(); + } + wNeonTransaction(amount, token) { + const from = this.neonWalletAddress; + const to = token.address; + const value = `0x0`; + const data = this.createWithdrawWNeonTransaction(this.web3.utils.toWei(amount.toString(), 'ether'), to); + return { from, to, value, data }; + } + neonTransaction(amount, token) { + const from = this.neonWalletAddress; + const to = token.address; + const value = `0x${BigInt(this.web3.utils.toWei(amount.toString(), 'ether')).toString(16)}`; + const data = this.createWithdrawEthTransactionData(); + return { from, to, value, data }; + } +} +exports.NeonPortal = NeonPortal; diff --git a/dist/cjs/core/deprecated/index.js b/dist/cjs/core/deprecated/index.js new file mode 100644 index 00000000..bbfe6899 --- /dev/null +++ b/dist/cjs/core/deprecated/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MintPortal = exports.NeonPortal = void 0; +var NeonPortal_1 = require("./NeonPortal"); +Object.defineProperty(exports, "NeonPortal", { enumerable: true, get: function () { return NeonPortal_1.NeonPortal; } }); +var MintPortal_1 = require("./MintPortal"); +Object.defineProperty(exports, "MintPortal", { enumerable: true, get: function () { return MintPortal_1.MintPortal; } }); diff --git a/dist/cjs/core/index.js b/dist/cjs/core/index.js new file mode 100644 index 00000000..2862adf5 --- /dev/null +++ b/dist/cjs/core/index.js @@ -0,0 +1,21 @@ +"use strict"; +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./deprecated"), exports); +__exportStar(require("./utils"), exports); +__exportStar(require("./mint-transfer"), exports); +__exportStar(require("./neon-transfer"), exports); +__exportStar(require("./multy-transfer"), exports); diff --git a/dist/cjs/core/mint-transfer.js b/dist/cjs/core/mint-transfer.js new file mode 100644 index 00000000..6e8be3ac --- /dev/null +++ b/dist/cjs/core/mint-transfer.js @@ -0,0 +1,329 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createWrapAndTransferSOLTransactionWeb3 = exports.createUnwrapSOLTransaction = exports.createWrapSOLTransaction = exports.createAssociatedTokenAccountInstruction = exports.createMintSolanaTransaction = exports.createMintNeonTransaction = exports.mintNeonTransactionDataWeb3 = exports.createMintNeonTransactionWeb3 = exports.createExecFromDataInstructionV2 = exports.createExecFromDataInstruction = exports.createClaimInstruction = exports.createClaimInstructionKeys = exports.neonClaimTransactionFromSigner = exports.climeTransactionDataWeb3 = exports.createAccountBalanceInstruction = exports.createAccountBalanceForLegacyAccountInstruction = exports.createAccountV3Instruction = exports.createApproveDepositInstruction = exports.createComputeBudgetHeapFrameInstruction = exports.createComputeBudgetUtilsInstruction = exports.neonTransferMintTransaction = exports.neonTransferMintWeb3Transaction = void 0; +const web3_js_1 = require("@solana/web3.js"); +const spl_token_1 = require("@solana/spl-token"); +const buffer_1 = require("buffer"); +const utils_1 = require("../utils"); +const data_1 = require("../data"); +const utils_2 = require("./utils"); +function neonTransferMintWeb3Transaction(connection, web3, proxyApi, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, splToken, amount, chainId) { + return __awaiter(this, void 0, void 0, function* () { + const fullAmount = (0, utils_1.toFullAmount)(amount, splToken.decimals); + const associatedTokenAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(splToken.address_spl), solanaWallet); + const climeData = climeTransactionDataWeb3(web3, associatedTokenAddress, neonWallet, fullAmount); + const walletSigner = (0, utils_2.solanaWalletSigner)(web3, solanaWallet, neonWallet); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); + const { neonKeys, legacyAccounts } = yield createClaimInstruction(proxyApi, signedTransaction); + return neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, chainId); + }); +} +exports.neonTransferMintWeb3Transaction = neonTransferMintWeb3Transaction; +function neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, emulateSigner, neonKeys, legacyAccounts, neonTransaction, splToken, amount, chainId) { + return __awaiter(this, void 0, void 0, function* () { + const computedBudgetProgram = new web3_js_1.PublicKey(data_1.COMPUTE_BUDGET_ID); + const [delegatePDA] = (0, utils_2.authAccountAddress)(emulateSigner.address, neonEvmProgram, splToken); + const [neonWalletBalanceAddress] = (0, utils_2.neonBalanceProgramAddress)(neonWallet, neonEvmProgram, chainId); + const [emulateSignerBalanceAddress] = (0, utils_2.neonBalanceProgramAddress)(emulateSigner.address, neonEvmProgram, chainId); + const neonWalletBalanceAccount = yield connection.getAccountInfo(neonWalletBalanceAddress); + const emulateSignerBalanceAccount = yield connection.getAccountInfo(emulateSignerBalanceAddress); + const associatedTokenAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(splToken.address_spl), solanaWallet); + const transaction = new web3_js_1.Transaction({ feePayer: solanaWallet }); + transaction.add(createComputeBudgetHeapFrameInstruction(computedBudgetProgram, proxyStatus)); + transaction.add(createApproveDepositInstruction(solanaWallet, delegatePDA, associatedTokenAddress, amount)); + if (!neonWalletBalanceAccount) { + transaction.add(createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonWallet, chainId)); + } + if (!emulateSignerBalanceAccount) { + transaction.add(createAccountBalanceInstruction(solanaWallet, neonEvmProgram, emulateSigner.address, chainId)); + } + for (const account of legacyAccounts) { + const instruction = yield createAccountBalanceForLegacyAccountInstruction(connection, account, solanaWallet, neonEvmProgram, chainId); + if (instruction) { + transaction.add(instruction); + } + } + if (neonTransaction === null || neonTransaction === void 0 ? void 0 : neonTransaction.rawTransaction) { + transaction.add(createExecFromDataInstructionV2(solanaWallet, neonWallet, neonEvmProgram, neonTransaction.rawTransaction, neonKeys, proxyStatus, chainId)); + } + return transaction; + }); +} +exports.neonTransferMintTransaction = neonTransferMintTransaction; +function createComputeBudgetUtilsInstruction(programId, proxyStatus) { + var _a; + const a = buffer_1.Buffer.from([0x00]); + const b = buffer_1.Buffer.from((0, utils_1.toBytesInt32)(parseInt((_a = proxyStatus.NEON_COMPUTE_UNITS) !== null && _a !== void 0 ? _a : data_1.NEON_COMPUTE_UNITS))); + const c = buffer_1.Buffer.from((0, utils_1.toBytesInt32)(0)); + const data = buffer_1.Buffer.concat([a, b, c]); + return new web3_js_1.TransactionInstruction({ programId, data, keys: [] }); +} +exports.createComputeBudgetUtilsInstruction = createComputeBudgetUtilsInstruction; +function createComputeBudgetHeapFrameInstruction(programId, proxyStatus) { + var _a; + const a = buffer_1.Buffer.from([0x01]); + const b = buffer_1.Buffer.from((0, utils_1.toBytesInt32)(parseInt((_a = proxyStatus.NEON_HEAP_FRAME) !== null && _a !== void 0 ? _a : data_1.NEON_HEAP_FRAME))); + const data = buffer_1.Buffer.concat([a, b]); + return new web3_js_1.TransactionInstruction({ programId, data, keys: [] }); +} +exports.createComputeBudgetHeapFrameInstruction = createComputeBudgetHeapFrameInstruction; +function createApproveDepositInstruction(solanaWallet, neonPDAWallet, associatedToken, amount) { + return (0, spl_token_1.createApproveInstruction)(associatedToken, neonPDAWallet, solanaWallet, amount); +} +exports.createApproveDepositInstruction = createApproveDepositInstruction; +function createAccountV3Instruction(solanaWallet, neonPDAWallet, neonEvmProgram, neonWallet) { + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: neonPDAWallet, isSigner: false, isWritable: true } + ]; + const a = buffer_1.Buffer.from([40 /* EvmInstruction.CreateAccountV03 */]); + const b = buffer_1.Buffer.from(neonWallet.slice(2), 'hex'); + const data = buffer_1.Buffer.concat([a, b]); + return new web3_js_1.TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +exports.createAccountV3Instruction = createAccountV3Instruction; +function createAccountBalanceForLegacyAccountInstruction(connection, account, solanaWallet, neonEvmProgram, chainId) { + return __awaiter(this, void 0, void 0, function* () { + const accountAddress = new web3_js_1.PublicKey(account.pubkey); + const accountInfo = yield connection.getAccountInfo(accountAddress); + if (accountInfo) { + const neonAddress = `0x${accountInfo === null || accountInfo === void 0 ? void 0 : accountInfo.data.slice(1, 21).toString('hex')}`; + return createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonAddress, chainId); + } + return null; + }); +} +exports.createAccountBalanceForLegacyAccountInstruction = createAccountBalanceForLegacyAccountInstruction; +function createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonWallet, chainId) { + const [neonWalletAddress] = (0, utils_2.neonWalletProgramAddress)(neonWallet, neonEvmProgram); + const [balanceAddress] = (0, utils_2.neonBalanceProgramAddress)(neonWallet, neonEvmProgram, chainId); + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: balanceAddress, isSigner: false, isWritable: true }, + { pubkey: neonWalletAddress, isSigner: false, isWritable: true } + ]; + const a = buffer_1.Buffer.from([48 /* EvmInstruction.AccountCreateBalance */]); + const b = buffer_1.Buffer.from(neonWallet.slice(2), 'hex'); + const c = (0, utils_1.numberTo64BitLittleEndian)(chainId); + const data = buffer_1.Buffer.concat([a, b, c]); + return new web3_js_1.TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +exports.createAccountBalanceInstruction = createAccountBalanceInstruction; +function climeTransactionDataWeb3(web3, associatedToken, neonWallet, amount) { + const claimTo = (0, utils_2.erc20ForSPLContractWeb3)(web3).methods.claimTo(associatedToken.toBuffer(), neonWallet, amount); + return claimTo.encodeABI(); +} +exports.climeTransactionDataWeb3 = climeTransactionDataWeb3; +function neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = { + data: climeData, + gas: `0x5F5E100`, + gasPrice: `0x0`, + from: neonWallet, + to: splToken.address // contract address + }; + return walletSigner.signTransaction(transaction); + }); +} +exports.neonClaimTransactionFromSigner = neonClaimTransactionFromSigner; +function createClaimInstructionKeys(neonEmulate) { + const legacyAccounts = []; + const accountsMap = new Map(); + if (neonEmulate) { + const { accounts = [], solana_accounts = [] } = neonEmulate; + for (const account of accounts) { + const key = account['account']; + accountsMap.set(key, { pubkey: new web3_js_1.PublicKey(key), isSigner: false, isWritable: true }); + if (account['contract']) { + const key = account['contract']; + accountsMap.set(key, { pubkey: new web3_js_1.PublicKey(key), isSigner: false, isWritable: true }); + } + } + for (const account of solana_accounts) { + const { pubkey, is_legacy, is_writable } = account; + accountsMap.set(pubkey, { + pubkey: new web3_js_1.PublicKey(pubkey), + isSigner: false, + isWritable: is_writable + }); + if (is_legacy) { + legacyAccounts.push(account); + } + } + } + return { neonKeys: Array.from(accountsMap.values()), legacyAccounts }; +} +exports.createClaimInstructionKeys = createClaimInstructionKeys; +function createClaimInstruction(proxyApi, neonTransaction) { + return __awaiter(this, void 0, void 0, function* () { + if (neonTransaction.rawTransaction) { + const neonEmulate = yield proxyApi.neonEmulate([neonTransaction.rawTransaction.slice(2)]); + return createClaimInstructionKeys(neonEmulate); + } + return { neonKeys: [], legacyAccounts: [], neonTransaction }; + }); +} +exports.createClaimInstruction = createClaimInstruction; +function createExecFromDataInstruction(solanaWallet, neonPDAWallet, neonEvmProgram, neonRawTransaction, neonKeys, proxyStatus) { + const count = Number(proxyStatus.NEON_POOL_COUNT); + const treasuryPoolIndex = Math.floor(Math.random() * count) % count; + const [treasuryPoolAddress] = (0, utils_2.collateralPoolAddress)(neonEvmProgram, treasuryPoolIndex); + const a = buffer_1.Buffer.from([50 /* EvmInstruction.TransactionExecuteFromInstruction */]); + const b = buffer_1.Buffer.from((0, utils_1.toBytesInt32)(treasuryPoolIndex)); + const c = buffer_1.Buffer.from(neonRawTransaction.slice(2), 'hex'); + const data = buffer_1.Buffer.concat([a, b, c]); + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: treasuryPoolAddress, isSigner: false, isWritable: true }, + { pubkey: neonPDAWallet, isSigner: false, isWritable: true }, + { pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: neonEvmProgram, isSigner: false, isWritable: false }, + ...neonKeys + ]; + return new web3_js_1.TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +exports.createExecFromDataInstruction = createExecFromDataInstruction; +function createExecFromDataInstructionV2(solanaWallet, neonWallet, neonEvmProgram, neonRawTransaction, neonKeys, proxyStatus, chainId) { + var _a; + const count = Number((_a = proxyStatus.NEON_POOL_COUNT) !== null && _a !== void 0 ? _a : data_1.NEON_STATUS_DEVNET_SNAPSHOT.NEON_POOL_COUNT); + const treasuryPoolIndex = Math.floor(Math.random() * count) % count; + const [balanceAccount] = (0, utils_2.neonBalanceProgramAddress)(neonWallet, neonEvmProgram, chainId); + const [treasuryPoolAddress] = (0, utils_2.collateralPoolAddress)(neonEvmProgram, treasuryPoolIndex); + const a = buffer_1.Buffer.from([50 /* EvmInstruction.TransactionExecuteFromInstruction */]); + const b = buffer_1.Buffer.from((0, utils_1.toBytesInt32)(treasuryPoolIndex)); + const c = buffer_1.Buffer.from(neonRawTransaction.slice(2), 'hex'); + const data = buffer_1.Buffer.concat([a, b, c]); + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: treasuryPoolAddress, isSigner: false, isWritable: true }, + { pubkey: balanceAccount, isSigner: false, isWritable: true }, + { pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: true }, + ...neonKeys + ]; + return new web3_js_1.TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +exports.createExecFromDataInstructionV2 = createExecFromDataInstructionV2; +function createMintNeonTransactionWeb3(web3, neonWallet, associatedToken, splToken, amount, gasLimit = 5e4) { + return __awaiter(this, void 0, void 0, function* () { + const data = mintNeonTransactionDataWeb3(web3, associatedToken, splToken, amount); + const transaction = createMintNeonTransaction(neonWallet, splToken, data); + transaction.gasPrice = yield web3.eth.getGasPrice(); + transaction.gas = yield web3.eth.estimateGas(transaction); + transaction.nonce = (yield web3.eth.getTransactionCount(neonWallet)); + // @ts-ignore + transaction['gasLimit'] = transaction.gas > gasLimit ? transaction.gas + 1e4 : gasLimit; + return transaction; + }); +} +exports.createMintNeonTransactionWeb3 = createMintNeonTransactionWeb3; +function mintNeonTransactionDataWeb3(web3, associatedToken, splToken, amount) { + const fullAmount = (0, utils_1.toFullAmount)(amount, splToken.decimals); + return (0, utils_2.erc20ForSPLContractWeb3)(web3).methods.transferSolana(associatedToken.toBuffer(), fullAmount).encodeABI(); +} +exports.mintNeonTransactionDataWeb3 = mintNeonTransactionDataWeb3; +function createMintNeonTransaction(neonWallet, splToken, data) { + return { data, from: neonWallet, to: splToken.address, value: `0x0` }; +} +exports.createMintNeonTransaction = createMintNeonTransaction; +function createMintSolanaTransaction(solanaWallet, tokenMint, associatedToken, proxyStatus) { + const computedBudgetProgram = new web3_js_1.PublicKey(data_1.COMPUTE_BUDGET_ID); + const transaction = new web3_js_1.Transaction({ feePayer: solanaWallet }); + // transaction.add(createComputeBudgetUtilsInstruction(computedBudgetProgram, proxyStatus)); + transaction.add(createComputeBudgetHeapFrameInstruction(computedBudgetProgram, proxyStatus)); + transaction.add(createAssociatedTokenAccountInstruction(tokenMint, associatedToken, solanaWallet, solanaWallet)); + return transaction; +} +exports.createMintSolanaTransaction = createMintSolanaTransaction; +// #region Neon -> Solana +function createAssociatedTokenAccountInstruction(tokenMint, associatedAccount, owner, payer, associatedProgramId = spl_token_1.ASSOCIATED_TOKEN_PROGRAM_ID, programId = spl_token_1.TOKEN_PROGRAM_ID) { + const data = buffer_1.Buffer.from([0x01]); + const keys = [ + { pubkey: payer, isSigner: true, isWritable: true }, + { pubkey: associatedAccount, isSigner: false, isWritable: true }, + { pubkey: owner, isSigner: false, isWritable: false }, + { pubkey: tokenMint, isSigner: false, isWritable: false }, + { pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: programId, isSigner: false, isWritable: false }, + { pubkey: web3_js_1.SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false } + ]; + return new web3_js_1.TransactionInstruction({ programId: associatedProgramId, keys, data }); +} +exports.createAssociatedTokenAccountInstruction = createAssociatedTokenAccountInstruction; +function createWrapSOLTransaction(connection, solanaWallet, amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const tokenMint = new web3_js_1.PublicKey(splToken.address_spl); + const lamports = (0, utils_1.toFullAmount)(amount, splToken.decimals); + const associatedToken = (0, spl_token_1.getAssociatedTokenAddressSync)(tokenMint, solanaWallet); + const wSOLAccount = yield connection.getAccountInfo(associatedToken); + const transaction = new web3_js_1.Transaction({ feePayer: solanaWallet }); + const instructions = []; + if (!wSOLAccount) { + instructions.push(createAssociatedTokenAccountInstruction(tokenMint, associatedToken, solanaWallet, solanaWallet)); + } + instructions.push(web3_js_1.SystemProgram.transfer({ + fromPubkey: solanaWallet, + toPubkey: associatedToken, + lamports + })); + instructions.push((0, spl_token_1.createSyncNativeInstruction)(associatedToken, spl_token_1.TOKEN_PROGRAM_ID)); + transaction.add(...instructions); + return transaction; + }); +} +exports.createWrapSOLTransaction = createWrapSOLTransaction; +function createUnwrapSOLTransaction(connection, solanaWallet, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const tokenMint = new web3_js_1.PublicKey(splToken.address_spl); + const associatedToken = (0, spl_token_1.getAssociatedTokenAddressSync)(tokenMint, solanaWallet); + const wSOLAccount = yield connection.getAccountInfo(associatedToken); + if (!wSOLAccount) { + throw new Error(`Error: ${associatedToken.toBase58()} haven't created account...`); + } + const transaction = new web3_js_1.Transaction({ feePayer: solanaWallet }); + const instructions = []; + instructions.push((0, spl_token_1.createCloseAccountInstruction)(associatedToken, solanaWallet, solanaWallet)); + transaction.add(...instructions); + return transaction; + }); +} +exports.createUnwrapSOLTransaction = createUnwrapSOLTransaction; +function createWrapAndTransferSOLTransactionWeb3(connection, web3, proxyApi, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, splToken, amount, chainId = 111) { + return __awaiter(this, void 0, void 0, function* () { + const instructions = []; + const transaction = new web3_js_1.Transaction({ feePayer: solanaWallet }); + const tokenMint = new web3_js_1.PublicKey(splToken.address_spl); + const fullAmount = (0, utils_1.toFullAmount)(amount, splToken.decimals); + const associatedTokenAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(tokenMint, solanaWallet); + const wSOLAccount = yield connection.getAccountInfo(associatedTokenAddress); + const climeData = climeTransactionDataWeb3(web3, associatedTokenAddress, neonWallet, fullAmount); + const walletSigner = (0, utils_2.solanaWalletSigner)(web3, solanaWallet, neonWallet); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); + const { neonKeys, legacyAccounts } = yield createClaimInstruction(proxyApi, signedTransaction); + const mintTransaction = yield neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, chainId); + if (!wSOLAccount) { + instructions.push(createAssociatedTokenAccountInstruction(tokenMint, associatedTokenAddress, solanaWallet, solanaWallet)); + } + instructions.push(web3_js_1.SystemProgram.transfer({ + fromPubkey: solanaWallet, + toPubkey: associatedTokenAddress, + lamports: fullAmount + })); + instructions.push((0, spl_token_1.createSyncNativeInstruction)(associatedTokenAddress, spl_token_1.TOKEN_PROGRAM_ID)); + transaction.add(...instructions); + transaction.add(...mintTransaction.instructions); + return transaction; + }); +} +exports.createWrapAndTransferSOLTransactionWeb3 = createWrapAndTransferSOLTransactionWeb3; diff --git a/dist/cjs/core/multy-transfer.js b/dist/cjs/core/multy-transfer.js new file mode 100644 index 00000000..81ee03dd --- /dev/null +++ b/dist/cjs/core/multy-transfer.js @@ -0,0 +1,30 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.solanaSOLTransferTransaction = void 0; +const web3_js_1 = require("@solana/web3.js"); +const spl_token_1 = require("@solana/spl-token"); +const utils_1 = require("./utils"); +const utils_2 = require("../utils"); +const neon_transfer_1 = require("./neon-transfer"); +const mint_transfer_1 = require("./mint-transfer"); +function solanaSOLTransferTransaction(connection, solanaWallet, neonWallet, neonEvmProgram, neonTokenMint, token, amount, chainId = 111) { + return __awaiter(this, void 0, void 0, function* () { + const [balanceAddress] = (0, utils_1.neonBalanceProgramAddress)(neonWallet, neonEvmProgram, chainId); + const fullAmount = (0, utils_2.toFullAmount)(amount, token.decimals); + const associatedTokenAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(token.address_spl), solanaWallet); + const transaction = yield (0, mint_transfer_1.createWrapSOLTransaction)(connection, solanaWallet, amount, token); + transaction.add((0, spl_token_1.createApproveInstruction)(associatedTokenAddress, balanceAddress, solanaWallet, fullAmount)); + transaction.add((0, neon_transfer_1.createNeonDepositToBalanceInstruction)(chainId, solanaWallet, associatedTokenAddress, neonWallet, neonEvmProgram, neonTokenMint)); + return transaction; + }); +} +exports.solanaSOLTransferTransaction = solanaSOLTransferTransaction; diff --git a/dist/cjs/core/neon-transfer.js b/dist/cjs/core/neon-transfer.js new file mode 100644 index 00000000..f4ba0874 --- /dev/null +++ b/dist/cjs/core/neon-transfer.js @@ -0,0 +1,122 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.neonNeonTransactionWeb3 = exports.neonNeonTransaction = exports.wrappedNeonTransaction = exports.wrappedNeonTransactionDataWeb3 = exports.neonTransactionDataWeb3 = exports.createNeonTransferInstruction = exports.createNeonDepositInstruction = exports.createNeonDepositToBalanceInstruction = exports.solanaNEONTransferTransaction = void 0; +const web3_js_1 = require("@solana/web3.js"); +const spl_token_1 = require("@solana/spl-token"); +const web3_utils_1 = require("web3-utils"); +const utils_1 = require("../utils"); +const data_1 = require("../data"); +const utils_2 = require("./utils"); +function solanaNEONTransferTransaction(solanaWallet, neonWallet, neonEvmProgram, neonTokenMint, token, amount, chainId = 111, serviceWallet, rewardAmount) { + return __awaiter(this, void 0, void 0, function* () { + const neonToken = Object.assign(Object.assign({}, token), { decimals: Number(data_1.NEON_TOKEN_DECIMALS) }); + const [balanceAddress] = (0, utils_2.neonBalanceProgramAddress)(neonWallet, neonEvmProgram, chainId); + const fullAmount = (0, utils_1.toFullAmount)(amount, neonToken.decimals); + const associatedTokenAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(new web3_js_1.PublicKey(neonToken.address_spl), solanaWallet); + const transaction = new web3_js_1.Transaction({ feePayer: solanaWallet }); + transaction.add((0, spl_token_1.createApproveInstruction)(associatedTokenAddress, balanceAddress, solanaWallet, fullAmount)); + transaction.add(createNeonDepositToBalanceInstruction(chainId, solanaWallet, associatedTokenAddress, neonWallet, neonEvmProgram, neonTokenMint, serviceWallet)); + if (serviceWallet && rewardAmount) { + transaction.add(createNeonTransferInstruction(neonTokenMint, solanaWallet, serviceWallet, rewardAmount)); + } + return transaction; + }); +} +exports.solanaNEONTransferTransaction = solanaNEONTransferTransaction; +function createNeonDepositToBalanceInstruction(chainId, solanaWallet, tokenAddress, neonWallet, neonEvmProgram, tokenMint, serviceWallet) { + const [depositWallet] = (0, utils_2.authorityPoolAddress)(neonEvmProgram); + const [balanceAddress] = (0, utils_2.neonBalanceProgramAddress)(neonWallet, neonEvmProgram, chainId); + const [contractAddress] = (0, utils_2.neonWalletProgramAddress)(neonWallet, neonEvmProgram); + const poolAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(tokenMint, depositWallet, true); + const keys = [ + { pubkey: tokenMint, isSigner: false, isWritable: true }, + { pubkey: tokenAddress, isSigner: false, isWritable: true }, + { pubkey: poolAddress, isSigner: false, isWritable: true }, + { pubkey: balanceAddress, isSigner: false, isWritable: true }, + { pubkey: contractAddress, isSigner: false, isWritable: true }, + { pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, + { pubkey: serviceWallet ? serviceWallet : solanaWallet, isSigner: true, isWritable: true }, + { pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false } + ]; + const a = Buffer.from([49 /* EvmInstruction.DepositToBalance */]); + const b = Buffer.from(neonWallet.slice(2), 'hex'); + const c = (0, utils_1.numberTo64BitLittleEndian)(chainId); + const data = Buffer.concat([a, b, c]); + return new web3_js_1.TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +exports.createNeonDepositToBalanceInstruction = createNeonDepositToBalanceInstruction; +function createNeonDepositInstruction(solanaWallet, neonPDAWallet, depositWallet, neonWallet, neonEvmProgram, neonTokenMint, serviceWallet) { + const solanaAssociatedTokenAddress = (0, spl_token_1.getAssociatedTokenAddressSync)(neonTokenMint, solanaWallet); + const poolKey = (0, spl_token_1.getAssociatedTokenAddressSync)(neonTokenMint, depositWallet, true); + const keys = [ + { pubkey: solanaAssociatedTokenAddress, isSigner: false, isWritable: true }, + { pubkey: poolKey, isSigner: false, isWritable: true }, + { pubkey: neonPDAWallet, isSigner: false, isWritable: true }, + { pubkey: spl_token_1.TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, + { pubkey: serviceWallet ? serviceWallet : solanaWallet, isSigner: true, isWritable: true }, + { pubkey: web3_js_1.SystemProgram.programId, isSigner: false, isWritable: false } + ]; + const a = Buffer.from([39 /* EvmInstruction.DepositV03 */]); + const b = Buffer.from(neonWallet.slice(2), 'hex'); + const data = Buffer.concat([a, b]); + return new web3_js_1.TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +exports.createNeonDepositInstruction = createNeonDepositInstruction; +function createNeonTransferInstruction(neonTokenMint, solanaWallet, serviceWallet, rewardAmount) { + const from = (0, spl_token_1.getAssociatedTokenAddressSync)(neonTokenMint, solanaWallet, true); + const to = (0, spl_token_1.getAssociatedTokenAddressSync)(neonTokenMint, serviceWallet, true); + const fullAmount = (0, utils_1.toBigInt)(rewardAmount); + const keys = [ + { pubkey: from, isSigner: false, isWritable: true }, + { pubkey: to, isSigner: false, isWritable: true }, + { pubkey: solanaWallet, isSigner: true, isWritable: false } + ]; + const data = Buffer.alloc(spl_token_1.transferInstructionData.span); + spl_token_1.transferInstructionData.encode({ + instruction: spl_token_1.TokenInstruction.Transfer, + amount: fullAmount + }, data); + return new web3_js_1.TransactionInstruction({ programId: spl_token_1.TOKEN_PROGRAM_ID, keys, data }); +} +exports.createNeonTransferInstruction = createNeonTransferInstruction; +function neonTransactionDataWeb3(web3, solanaWallet) { + return (0, utils_2.neonWrapperContractWeb3)(web3).methods.withdraw(solanaWallet.toBuffer()).encodeABI(); +} +exports.neonTransactionDataWeb3 = neonTransactionDataWeb3; +function wrappedNeonTransactionDataWeb3(web3, token, amount) { + const value = (0, web3_utils_1.toWei)(amount.toString(), 'ether'); + const contract = (0, utils_2.neonWrapper2ContractWeb3)(web3, token.address); + return contract.methods.withdraw(value).encodeABI(); +} +exports.wrappedNeonTransactionDataWeb3 = wrappedNeonTransactionDataWeb3; +function wrappedNeonTransaction(from, to, data) { + const value = `0x0`; + return { from, to, value, data }; +} +exports.wrappedNeonTransaction = wrappedNeonTransaction; +function neonNeonTransaction(from, to, amount, data) { + const value = `0x${BigInt((0, web3_utils_1.toWei)(amount.toString(), 'ether')).toString(16)}`; + return { from, to, value, data }; +} +exports.neonNeonTransaction = neonNeonTransaction; +function neonNeonTransactionWeb3(web3, from, to, solanaWallet, amount, gasLimit = 5e4) { + return __awaiter(this, void 0, void 0, function* () { + const data = neonTransactionDataWeb3(web3, solanaWallet); + const transaction = neonNeonTransaction(from, to, amount, data); + transaction.gasPrice = yield web3.eth.getGasPrice(); + transaction.gas = yield web3.eth.estimateGas(transaction); + // @ts-ignore + transaction['gasLimit'] = transaction.gas > gasLimit ? transaction.gas + 1e4 : gasLimit; + return transaction; + }); +} +exports.neonNeonTransactionWeb3 = neonNeonTransactionWeb3; diff --git a/dist/cjs/core/utils/accounts.js b/dist/cjs/core/utils/accounts.js new file mode 100644 index 00000000..fd69d7d6 --- /dev/null +++ b/dist/cjs/core/utils/accounts.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.solanaWalletSigner = void 0; +const crypto_js_1 = require("crypto-js"); +function solanaWalletSigner(web3, solanaWallet, neonWallet) { + const emulateSignerPrivateKey = `0x${(0, crypto_js_1.SHA256)(solanaWallet.toBase58() + neonWallet).toString()}`; + return web3.eth.accounts.privateKeyToAccount(emulateSignerPrivateKey); +} +exports.solanaWalletSigner = solanaWalletSigner; diff --git a/dist/cjs/core/utils/addresses.js b/dist/cjs/core/utils/addresses.js new file mode 100644 index 00000000..2ce4e553 --- /dev/null +++ b/dist/cjs/core/utils/addresses.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.authorityPoolAddress = exports.collateralPoolAddress = exports.authAccountAddress = exports.neonBalanceProgramAddress = exports.neonWalletProgramAddress = void 0; +const web3_js_1 = require("@solana/web3.js"); +const buffer_1 = require("buffer"); +const utils_1 = require("../../utils"); +function neonWalletProgramAddress(etherKey, neonEvmProgram) { + const keyBuffer = buffer_1.Buffer.from((0, utils_1.isValidHex)(etherKey) ? etherKey.replace(/^0x/i, '') : etherKey, 'hex'); + const seed = [new Uint8Array([3 /* AccountHex.SeedVersion */]), new Uint8Array(keyBuffer)]; + return web3_js_1.PublicKey.findProgramAddressSync(seed, neonEvmProgram); +} +exports.neonWalletProgramAddress = neonWalletProgramAddress; +function neonBalanceProgramAddress(etherKey, neonEvmProgram, chainId) { + const keyBuffer = buffer_1.Buffer.from((0, utils_1.isValidHex)(etherKey) ? etherKey.replace(/^0x/i, '') : etherKey, 'hex'); + const chainIdBytes = (0, utils_1.toU256BE)(BigInt(chainId)); //chain_id as u256be + const seed = [ + new Uint8Array([3 /* AccountHex.SeedVersion */]), + new Uint8Array(keyBuffer), + chainIdBytes + ]; + return web3_js_1.PublicKey.findProgramAddressSync(seed, neonEvmProgram); +} +exports.neonBalanceProgramAddress = neonBalanceProgramAddress; +function authAccountAddress(neonWallet, neonEvmProgram, splToken) { + const neonAccountAddressBytes = buffer_1.Buffer.concat([buffer_1.Buffer.alloc(12), buffer_1.Buffer.from((0, utils_1.isValidHex)(neonWallet) ? neonWallet.replace(/^0x/i, '') : neonWallet, 'hex')]); + const neonContractAddressBytes = buffer_1.Buffer.from((0, utils_1.isValidHex)(splToken.address) ? splToken.address.replace(/^0x/i, '') : splToken.address, 'hex'); + const seed = [ + new Uint8Array([3 /* AccountHex.SeedVersion */]), + new Uint8Array(buffer_1.Buffer.from('AUTH', 'utf-8')), + new Uint8Array(neonContractAddressBytes), + new Uint8Array(neonAccountAddressBytes) + ]; + return web3_js_1.PublicKey.findProgramAddressSync(seed, neonEvmProgram); +} +exports.authAccountAddress = authAccountAddress; +function collateralPoolAddress(neonWalletPDA, collateralPoolIndex) { + const a = buffer_1.Buffer.from('treasury_pool', 'utf8'); + const b = buffer_1.Buffer.from((0, utils_1.toBytesInt32)(collateralPoolIndex)); + return web3_js_1.PublicKey.findProgramAddressSync([a, b], neonWalletPDA); +} +exports.collateralPoolAddress = collateralPoolAddress; +function authorityPoolAddress(programId) { + return web3_js_1.PublicKey.findProgramAddressSync([new Uint8Array(buffer_1.Buffer.from('Deposit', 'utf-8'))], programId); +} +exports.authorityPoolAddress = authorityPoolAddress; diff --git a/dist/cjs/core/utils/contracts.js b/dist/cjs/core/utils/contracts.js new file mode 100644 index 00000000..b41b8506 --- /dev/null +++ b/dist/cjs/core/utils/contracts.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.neonWrapper2ContractWeb3 = exports.neonWrapperContractWeb3 = exports.erc20ForSPLContractWeb3 = void 0; +const data_1 = require("../../data"); +function erc20ForSPLContractWeb3(web3) { + return new web3.eth.Contract(data_1.erc20Abi); +} +exports.erc20ForSPLContractWeb3 = erc20ForSPLContractWeb3; +function neonWrapperContractWeb3(web3) { + return new web3.eth.Contract(data_1.neonWrapperAbi); +} +exports.neonWrapperContractWeb3 = neonWrapperContractWeb3; +function neonWrapper2ContractWeb3(web3, address) { + return new web3.eth.Contract(data_1.neonWrapper2Abi, address); +} +exports.neonWrapper2ContractWeb3 = neonWrapper2ContractWeb3; diff --git a/dist/cjs/core/utils/index.js b/dist/cjs/core/utils/index.js new file mode 100644 index 00000000..3a632a1b --- /dev/null +++ b/dist/cjs/core/utils/index.js @@ -0,0 +1,19 @@ +"use strict"; +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./accounts"), exports); +__exportStar(require("./addresses"), exports); +__exportStar(require("./contracts"), exports); diff --git a/dist/cjs/data/abi/erc20.js b/dist/cjs/data/abi/erc20.js new file mode 100644 index 00000000..b9650a83 --- /dev/null +++ b/dist/cjs/data/abi/erc20.js @@ -0,0 +1,456 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.erc20Abi = void 0; +exports.erc20Abi = [ + { + 'inputs': [ + { + 'internalType': 'string', + 'name': '_name', + 'type': 'string' + }, + { + 'internalType': 'string', + 'name': '_symbol', + 'type': 'string' + }, + { + 'internalType': 'bytes32', + 'name': '_tokenMint', + 'type': 'bytes32' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'constructor' + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'internalType': 'address', + 'name': 'owner', + 'type': 'address' + }, + { + 'indexed': true, + 'internalType': 'address', + 'name': 'spender', + 'type': 'address' + }, + { + 'indexed': false, + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'Approval', + 'type': 'event' + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'internalType': 'address', + 'name': 'owner', + 'type': 'address' + }, + { + 'indexed': true, + 'internalType': 'bytes32', + 'name': 'spender', + 'type': 'bytes32' + }, + { + 'indexed': false, + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'ApprovalSolana', + 'type': 'event' + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'internalType': 'address', + 'name': 'from', + 'type': 'address' + }, + { + 'indexed': true, + 'internalType': 'address', + 'name': 'to', + 'type': 'address' + }, + { + 'indexed': false, + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'Transfer', + 'type': 'event' + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'internalType': 'address', + 'name': 'from', + 'type': 'address' + }, + { + 'indexed': true, + 'internalType': 'bytes32', + 'name': 'to', + 'type': 'bytes32' + }, + { + 'indexed': false, + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'TransferSolana', + 'type': 'event' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'owner', + 'type': 'address' + }, + { + 'internalType': 'address', + 'name': 'spender', + 'type': 'address' + } + ], + 'name': 'allowance', + 'outputs': [ + { + 'internalType': 'uint256', + 'name': '', + 'type': 'uint256' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'spender', + 'type': 'address' + }, + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'approve', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': 'spender', + 'type': 'bytes32' + }, + { + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'approveSolana', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'who', + 'type': 'address' + } + ], + 'name': 'balanceOf', + 'outputs': [ + { + 'internalType': 'uint256', + 'name': '', + 'type': 'uint256' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'burn', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'from', + 'type': 'address' + }, + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'burnFrom', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': 'from', + 'type': 'bytes32' + }, + { + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'claim', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': 'from', + 'type': 'bytes32' + }, + { + 'internalType': 'address', + 'name': 'to', + 'type': 'address' + }, + { + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'claimTo', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'decimals', + 'outputs': [ + { + 'internalType': 'uint8', + 'name': '', + 'type': 'uint8' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'name', + 'outputs': [ + { + 'internalType': 'string', + 'name': '', + 'type': 'string' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'symbol', + 'outputs': [ + { + 'internalType': 'string', + 'name': '', + 'type': 'string' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'tokenMint', + 'outputs': [ + { + 'internalType': 'bytes32', + 'name': '', + 'type': 'bytes32' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'totalSupply', + 'outputs': [ + { + 'internalType': 'uint256', + 'name': '', + 'type': 'uint256' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'to', + 'type': 'address' + }, + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'transfer', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'from', + 'type': 'address' + }, + { + 'internalType': 'address', + 'name': 'to', + 'type': 'address' + }, + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'transferFrom', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': 'to', + 'type': 'bytes32' + }, + { + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'transferSolana', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + } +]; +exports.default = exports.erc20Abi; diff --git a/dist/cjs/data/abi/index.js b/dist/cjs/data/abi/index.js new file mode 100644 index 00000000..e8bdb074 --- /dev/null +++ b/dist/cjs/data/abi/index.js @@ -0,0 +1,19 @@ +"use strict"; +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./erc20"), exports); +__exportStar(require("./neonWrapper"), exports); +__exportStar(require("./neonWrapper2"), exports); diff --git a/dist/cjs/data/abi/neonWrapper.js b/dist/cjs/data/abi/neonWrapper.js new file mode 100644 index 00000000..99d610fc --- /dev/null +++ b/dist/cjs/data/abi/neonWrapper.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.neonWrapperAbi = void 0; +exports.neonWrapperAbi = [ + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': '', + 'type': 'bytes32' + } + ], + 'name': 'withdraw', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'payable', + 'type': 'function' + } +]; +exports.default = exports.neonWrapperAbi; diff --git a/dist/cjs/data/abi/neonWrapper2.js b/dist/cjs/data/abi/neonWrapper2.js new file mode 100644 index 00000000..2677a385 --- /dev/null +++ b/dist/cjs/data/abi/neonWrapper2.js @@ -0,0 +1,132 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.neonWrapper2Abi = void 0; +exports.neonWrapper2Abi = [{ + 'constant': true, + 'inputs': [], + 'name': 'name', + 'outputs': [{ 'name': '', 'type': 'string' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [{ 'name': 'guy', 'type': 'address' }, { 'name': 'wad', 'type': 'uint256' }], + 'name': 'approve', + 'outputs': [{ 'name': '', 'type': 'bool' }], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [], + 'name': 'totalSupply', + 'outputs': [{ 'name': '', 'type': 'uint256' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [{ 'name': 'src', 'type': 'address' }, { + 'name': 'dst', + 'type': 'address' + }, { 'name': 'wad', 'type': 'uint256' }], + 'name': 'transferFrom', + 'outputs': [{ 'name': '', 'type': 'bool' }], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [{ 'name': 'wad', 'type': 'uint256' }], + 'name': 'withdraw', + 'outputs': [], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [], + 'name': 'decimals', + 'outputs': [{ 'name': '', 'type': 'uint8' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [{ 'name': '', 'type': 'address' }], + 'name': 'balanceOf', + 'outputs': [{ 'name': '', 'type': 'uint256' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [], + 'name': 'symbol', + 'outputs': [{ 'name': '', 'type': 'string' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [{ 'name': 'dst', 'type': 'address' }, { 'name': 'wad', 'type': 'uint256' }], + 'name': 'transfer', + 'outputs': [{ 'name': '', 'type': 'bool' }], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [], + 'name': 'deposit', + 'outputs': [], + 'payable': true, + 'stateMutability': 'payable', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [{ 'name': '', 'type': 'address' }, { 'name': '', 'type': 'address' }], + 'name': 'allowance', + 'outputs': [{ 'name': '', 'type': 'uint256' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { 'payable': true, 'stateMutability': 'payable', 'type': 'fallback' }, { + 'anonymous': false, + 'inputs': [{ 'indexed': true, 'name': 'src', 'type': 'address' }, { + 'indexed': true, + 'name': 'guy', + 'type': 'address' + }, { 'indexed': false, 'name': 'wad', 'type': 'uint256' }], + 'name': 'Approval', + 'type': 'event' + }, { + 'anonymous': false, + 'inputs': [{ 'indexed': true, 'name': 'src', 'type': 'address' }, { + 'indexed': true, + 'name': 'dst', + 'type': 'address' + }, { 'indexed': false, 'name': 'wad', 'type': 'uint256' }], + 'name': 'Transfer', + 'type': 'event' + }, { + 'anonymous': false, + 'inputs': [{ 'indexed': true, 'name': 'dst', 'type': 'address' }, { + 'indexed': false, + 'name': 'wad', + 'type': 'uint256' + }], + 'name': 'Deposit', + 'type': 'event' + }, { + 'anonymous': false, + 'inputs': [{ 'indexed': true, 'name': 'src', 'type': 'address' }, { + 'indexed': false, + 'name': 'wad', + 'type': 'uint256' + }], + 'name': 'Withdrawal', + 'type': 'event' + }]; +exports.default = exports.neonWrapper2Abi; diff --git a/dist/cjs/data/constants.js b/dist/cjs/data/constants.js new file mode 100644 index 00000000..f453e47b --- /dev/null +++ b/dist/cjs/data/constants.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SOL_TOKEN_MINT_MAINNET = exports.NEON_TOKEN_MINT_MAINNET = exports.SOL_TOKEN_MINT_DEVNET = exports.NEON_TOKEN_MINT_DEVNET = exports.NEON_COMPUTE_UNITS = exports.NEON_HEAP_FRAME = exports.COMPUTE_BUDGET_ID = exports.SYSVAR_INSTRUCTION_PUBKEY = exports.INCINERATOR_PUBKEY = exports.KECCAK_PROGRAM = exports.NEON_TRANSFER_CONTRACT_MAINNET = exports.NEON_TRANSFER_CONTRACT_TESTNET = exports.SOL_TRANSFER_CONTRACT_DEVNET = exports.NEON_TRANSFER_CONTRACT_DEVNET = exports.NEON_TOKEN_MINT_DECIMALS = exports.NEON_TOKEN_DECIMALS = void 0; +exports.NEON_TOKEN_DECIMALS = 9; +exports.NEON_TOKEN_MINT_DECIMALS = 18; +exports.NEON_TRANSFER_CONTRACT_DEVNET = '0x5238c694a8db837fff8c4068859e765b978a7607'; +exports.SOL_TRANSFER_CONTRACT_DEVNET = '0xf9949Ae1f5982181d163B1f095b010CeD2e8D6f7'; +exports.NEON_TRANSFER_CONTRACT_TESTNET = '0x5238c694a8db837fff8c4068859e765b978a7607'; +exports.NEON_TRANSFER_CONTRACT_MAINNET = '0xaC6FEaF379B01e3B0888597c53bb37e2B0b513ab'; +exports.KECCAK_PROGRAM = 'KeccakSecp256k11111111111111111111111111111'; +exports.INCINERATOR_PUBKEY = '1nc1nerator11111111111111111111111111111111'; +exports.SYSVAR_INSTRUCTION_PUBKEY = 'Sysvar1nstructions1111111111111111111111111'; +exports.COMPUTE_BUDGET_ID = 'ComputeBudget111111111111111111111111111111'; +exports.NEON_HEAP_FRAME = '262144'; +exports.NEON_COMPUTE_UNITS = '500000'; +exports.NEON_TOKEN_MINT_DEVNET = '89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g'; +exports.SOL_TOKEN_MINT_DEVNET = '89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g'; +exports.NEON_TOKEN_MINT_MAINNET = 'NeonTjSjsuo3rexg9o6vHuMXw62f9V7zvmu8M8Zut44'; +exports.SOL_TOKEN_MINT_MAINNET = 'NeonTjSjsuo3rexg9o6vHuMXw62f9V7zvmu8M8Zut44'; diff --git a/dist/cjs/data/index.js b/dist/cjs/data/index.js new file mode 100644 index 00000000..d2c5c636 --- /dev/null +++ b/dist/cjs/data/index.js @@ -0,0 +1,28 @@ +"use strict"; +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.neonWrapper2Abi = exports.neonWrapperAbi = exports.erc20Abi = void 0; +const erc20_1 = __importDefault(require("./abi/erc20")); +exports.erc20Abi = erc20_1.default; +const neonWrapper_1 = __importDefault(require("./abi/neonWrapper")); +exports.neonWrapperAbi = neonWrapper_1.default; +const neonWrapper2_1 = __importDefault(require("./abi/neonWrapper2")); +exports.neonWrapper2Abi = neonWrapper2_1.default; +__exportStar(require("./constants"), exports); +__exportStar(require("./proxy"), exports); diff --git a/dist/cjs/data/proxy.js b/dist/cjs/data/proxy.js new file mode 100644 index 00000000..02f86844 --- /dev/null +++ b/dist/cjs/data/proxy.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TOKEN_LIST_DEVNET_SNAPSHOT = exports.NEON_STATUS_DEVNET_SNAPSHOT = exports.NEON_STATUS_MAINNET_SNAPSHOT = void 0; +exports.NEON_STATUS_MAINNET_SNAPSHOT = { + NEON_ACCOUNT_SEED_VERSION: '3', + NEON_ADDITIONAL_FEE: '0', + NEON_CHAIN_ID: '245022934', + NEON_COMPUTE_BUDGET_HEAP_FRAME: '262144', + NEON_COMPUTE_BUDGET_UNITS: '500000', + NEON_COMPUTE_UNITS: '500000', + NEON_EVM_STEPS_LAST_ITERATION_MAX: '1', + NEON_EVM_STEPS_MIN: '500', + NEON_GAS_LIMIT_MULTIPLIER_NO_CHAINID: '1000', + NEON_HEAP_FRAME: '262144', + NEON_HOLDER_MSG_SIZE: '950', + NEON_OPERATOR_PRIORITY_SLOTS: '16', + NEON_PAYMENT_TO_DEPOSIT: '5000', + NEON_PAYMENT_TO_TREASURE: '5000', + NEON_PKG_VERSION: '1.0.0', + NEON_POOL_COUNT: '128', + NEON_POOL_SEED: 'treasury_pool', + NEON_REQUEST_UNITS_ADDITIONAL_FEE: '0', + NEON_REVISION: '3cece008d1520c1183fbd59370a90b5e5350b9e7', + NEON_SEED_VERSION: '3', + NEON_STATUS_NAME: 'WORK', + NEON_STORAGE_ENTRIES_IN_CONTRACT_ACCOUNT: '64', + NEON_TOKEN_MINT: 'NeonTjSjsuo3rexg9o6vHuMXw62f9V7zvmu8M8Zut44', + NEON_TOKEN_MINT_DECIMALS: '9', + NEON_TREASURY_POOL_COUNT: '128', + NEON_TREASURY_POOL_SEED: 'treasury_pool', + NEON_EVM_ID: 'NeonVMyRX5GbCrsAHnUwx1nYYoJAtskU1bWUo6JGNyG' +}; +exports.NEON_STATUS_DEVNET_SNAPSHOT = { + NEON_ACCOUNT_SEED_VERSION: '3', + NEON_EVM_ID: 'eeLSJgWzzxrqKv1UxtRVVH8FX3qCQWUs9QuAjJpETGU', + NEON_EVM_STEPS_LAST_ITERATION_MAX: '1', + NEON_EVM_STEPS_MIN: '500', + NEON_GAS_LIMIT_MULTIPLIER_NO_CHAINID: '1000', + NEON_HOLDER_MSG_SIZE: '950', + NEON_OPERATOR_PRIORITY_SLOTS: '16', + NEON_PAYMENT_TO_TREASURE: '5000', + NEON_STORAGE_ENTRIES_IN_CONTRACT_ACCOUNT: '64', + NEON_TREASURY_POOL_COUNT: '128', + NEON_TREASURY_POOL_SEED: 'treasury_pool' +}; +exports.TOKEN_LIST_DEVNET_SNAPSHOT = [{ + token_name: 'NEON', + token_mint: '89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g', + token_chain_id: '0xe9ac0ce' + }, { + token_name: 'SOL', + token_mint: 'So11111111111111111111111111111111111111112', + token_chain_id: '0xe9ac0cf' + }]; +const proxyStatusSnapshot = new Map(); +proxyStatusSnapshot.set('mainnet', exports.NEON_STATUS_MAINNET_SNAPSHOT); +proxyStatusSnapshot.set('devnet', exports.NEON_STATUS_DEVNET_SNAPSHOT); diff --git a/dist/cjs/index.js b/dist/cjs/index.js new file mode 100644 index 00000000..778ac1ab --- /dev/null +++ b/dist/cjs/index.js @@ -0,0 +1,22 @@ +"use strict"; +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./api"), exports); +__exportStar(require("./core"), exports); +__exportStar(require("./data"), exports); +__exportStar(require("./models"), exports); +__exportStar(require("./react"), exports); +__exportStar(require("./utils"), exports); diff --git a/dist/cjs/models/api.js b/dist/cjs/models/api.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/dist/cjs/models/api.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/cjs/models/events.js b/dist/cjs/models/events.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/dist/cjs/models/events.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/cjs/models/index.js b/dist/cjs/models/index.js new file mode 100644 index 00000000..62ba87d5 --- /dev/null +++ b/dist/cjs/models/index.js @@ -0,0 +1,20 @@ +"use strict"; +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./api"), exports); +__exportStar(require("./events"), exports); +__exportStar(require("./instruction"), exports); +__exportStar(require("./token"), exports); diff --git a/dist/cjs/models/instruction.js b/dist/cjs/models/instruction.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/dist/cjs/models/instruction.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/cjs/models/token.js b/dist/cjs/models/token.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/dist/cjs/models/token.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/cjs/react/index.js b/dist/cjs/react/index.js new file mode 100644 index 00000000..4e64b4ca --- /dev/null +++ b/dist/cjs/react/index.js @@ -0,0 +1,18 @@ +"use strict"; +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./neon-transfer"), exports); +__exportStar(require("./proxy-status"), exports); diff --git a/dist/cjs/react/neon-transfer.js b/dist/cjs/react/neon-transfer.js new file mode 100644 index 00000000..1d9c3758 --- /dev/null +++ b/dist/cjs/react/neon-transfer.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.useNeonTransfer = exports.proxyApi = void 0; +const api_1 = require("../api"); +const core_1 = require("../core"); +const proxy_status_1 = require("./proxy-status"); +const data_1 = require("../data"); +const urls = process.env.REACT_APP_URLS ? JSON.parse(process.env.REACT_APP_URLS) : { + solanaRpcApi: 'https://api.devnet.solana.com', + neonProxyRpcApi: 'https://devnet.neonevm.org' +}; +exports.proxyApi = new api_1.NeonProxyRpcApi({ + solanaRpcApi: urls.solanaRpcApi, + neonProxyRpcApi: urls.neonProxyRpcApi +}); +/* +* @deprecated this code was deprecated and will remove in next releases. +* Please, don't use this hock in you codebase, for more details see our React Demo in `examples` folder +* */ +function useNeonTransfer(events, connection, web3, publicKey, neonWalletAddress, neonContractAddress = data_1.NEON_TRANSFER_CONTRACT_DEVNET) { + const proxyStatus = (0, proxy_status_1.useProxyInfo)(exports.proxyApi); + const options = { + connection: connection, + solanaWalletAddress: publicKey, + neonWalletAddress, + neonContractAddress, + web3, + proxyApi: exports.proxyApi, + proxyStatus: proxyStatus + }; + const neonPortal = new core_1.NeonPortal(options); + const mintPortal = new core_1.MintPortal(options); + const portalInstance = (addr) => { + return proxyStatus.NEON_TOKEN_MINT === addr ? neonPortal : mintPortal; + }; + const getEthereumTransactionParams = (amount, splToken) => { + const portal = portalInstance(splToken.address_spl); + return portal.ethereumTransaction.call(portal, amount, splToken); + }; + const deposit = (amount, splToken) => { + const portal = portalInstance(splToken.address_spl); + return portal.createNeonTransfer.call(portal, amount, splToken, events); + }; + const withdraw = (amount, splToken, to) => { + const portal = portalInstance(splToken.address_spl); + return portal.createSolanaTransfer.call(portal, amount, splToken, events); + }; + return { deposit, withdraw, getEthereumTransactionParams, proxyStatus }; +} +exports.useNeonTransfer = useNeonTransfer; diff --git a/dist/cjs/react/proxy-status.js b/dist/cjs/react/proxy-status.js new file mode 100644 index 00000000..49b8b052 --- /dev/null +++ b/dist/cjs/react/proxy-status.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.useProxyInfo = exports.proxyStatus = void 0; +const react_1 = require("react"); +exports.proxyStatus = 'proxyStatus'; +function useProxyInfo(api) { + const [status, setStatus] = (0, react_1.useState)({}); + (0, react_1.useEffect)(() => { + if ('localStorage' in window) { + const data = localStorage.getItem(exports.proxyStatus); + if (data && data.length > 0) { + try { + const parse = JSON.parse(data); + setStatus(parse); + } + catch (e) { + // + } + } + } + }, []); + (0, react_1.useEffect)(() => { + api.evmParams().then(result => { + setStatus(result); + if ('localStorage' in window) { + localStorage.setItem(exports.proxyStatus, JSON.stringify(result)); + } + }).catch(e => console.log(e)); + }, [api]); + return status; +} +exports.useProxyInfo = useProxyInfo; diff --git a/dist/cjs/utils/address.js b/dist/cjs/utils/address.js new file mode 100644 index 00000000..fd8664f0 --- /dev/null +++ b/dist/cjs/utils/address.js @@ -0,0 +1,50 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toU256BE = exports.numberTo64BitLittleEndian = exports.toBigInt = exports.toFullAmount = exports.toBytesInt32 = void 0; +const big_js_1 = __importDefault(require("big.js")); +function toBytesInt32(number, littleEndian = true) { + const arrayBuffer = new ArrayBuffer(4); // an Int32 takes 4 bytes + const dataView = new DataView(arrayBuffer); + dataView.setUint32(0, number, littleEndian); // byteOffset = 0; litteEndian = false + return arrayBuffer; +} +exports.toBytesInt32 = toBytesInt32; +function toFullAmount(amount, decimals) { + const data = new big_js_1.default(amount.toString()).times((0, big_js_1.default)(10).pow(decimals)); + return BigInt(data.toString()); +} +exports.toFullAmount = toFullAmount; +function toBigInt(amount) { + const data = new big_js_1.default(amount.toString()); + return BigInt(data.toString()); +} +exports.toBigInt = toBigInt; +function numberTo64BitLittleEndian(num) { + const buffer = new ArrayBuffer(8); // 64 bits = 8 bytes + const view = new DataView(buffer); + // Split the number into high and low 32-bit parts + const low = num % Math.pow(2, 32); + const high = Math.floor(num / Math.pow(2, 32)); + view.setUint32(0, low, true); // true for little-endian + view.setUint32(4, high, true); // high part is set after low part + return new Uint8Array(buffer); +} +exports.numberTo64BitLittleEndian = numberTo64BitLittleEndian; +function toU256BE(bigIntNumber) { + if (bigIntNumber < BigInt(0) || bigIntNumber > BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF')) { + throw new Error('Number out of range for U256BE'); + } + const buffer = new ArrayBuffer(32); // 256 bits = 32 bytes + const view = new DataView(buffer); + // Loop through each byte and set it from the start to maintain big-endian order + for (let i = 0; i < 32; i++) { + // Extract each byte of the BigInt number + const byte = Number((bigIntNumber >> BigInt(8 * (31 - i))) & BigInt(0xFF)); + view.setUint8(i, byte); + } + return new Uint8Array(buffer); +} +exports.toU256BE = toU256BE; diff --git a/dist/cjs/utils/hex.js b/dist/cjs/utils/hex.js new file mode 100644 index 00000000..687369bb --- /dev/null +++ b/dist/cjs/utils/hex.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isValidHex = void 0; +function isValidHex(hex) { + const isHexStrict = /^(0x)?[0-9a-f]*$/i.test(hex.toString()); + if (!isHexStrict) { + throw new Error(`Given value "${hex}" is not a valid hex string.`); + } + return isHexStrict; +} +exports.isValidHex = isValidHex; diff --git a/dist/cjs/utils/index.js b/dist/cjs/utils/index.js new file mode 100644 index 00000000..9177b9f7 --- /dev/null +++ b/dist/cjs/utils/index.js @@ -0,0 +1,19 @@ +"use strict"; +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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./address"), exports); +__exportStar(require("./hex"), exports); +__exportStar(require("./transaction"), exports); diff --git a/dist/cjs/utils/transaction.js b/dist/cjs/utils/transaction.js new file mode 100644 index 00000000..13cf1e9a --- /dev/null +++ b/dist/cjs/utils/transaction.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.solanaTransactionLog = void 0; +const bs58_1 = require("bs58"); +function solanaTransactionLog(transaction) { + console.log(transaction.instructions.map(({ programId, keys, data }, index) => { + return `[${index}] programId: ${programId.toBase58()} +keys: +${keys.map(k => `${k.pubkey.toBase58()} [${k.isSigner ? 'signer' : ''}${k.isSigner && k.isWritable ? ', ' : ''}${k.isWritable ? 'writer' : ''}]`).join('\n')} +data: +${(0, bs58_1.encode)(data)} +0x${Buffer.from(data).toString('hex')} +${JSON.stringify(data)} +------------------------------`; + }).join('\n\n')); +} +exports.solanaTransactionLog = solanaTransactionLog; diff --git a/dist/core/deprecated/InstructionService.js.map b/dist/core/deprecated/InstructionService.js.map deleted file mode 100644 index 34cf8af7..00000000 --- a/dist/core/deprecated/InstructionService.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"InstructionService.js","sourceRoot":"","sources":["../../../src/core/deprecated/InstructionService.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAGV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAQ5F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ/F,OAAO,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ortal.js deleted file mode 100644 index 4e003deb..00000000 --- a/dist/core/deprecated/MintPortal.js +++ /dev/null @@ -1,102 +0,0 @@ -import { createAssociatedTokenAccountInstruction, getAssociatedTokenAddressSync } from '@solana/spl-token'; -import { PublicKey } from '@solana/web3.js'; -import { toFullAmount } from '../../utils'; -import { climeTransactionData, createClaimInstruction, createComputeBudgetHeapFrameInstruction, createComputeBudgetUtilsInstruction, createExecFromDataInstruction, createMintNeonWeb3Transaction, createMintSolanaTransaction, createUnwrapSOLTransaction, createWrapSOLTransaction, neonClaimTransactionFromSigner, neonTransferMintTransaction } from '../mint-transfer'; -import { collateralPoolAddress, solanaWalletSigner } from '../utils'; -import { InstructionService } from './InstructionService'; -/** - * @deprecated this code was deprecated and will remove in next releases. - * Please use other methods in mint-transfer.ts file - * For more examples see `examples` folder - */ -export class MintPortal extends InstructionService { - // Solana -> Neon - async createNeonTransfer(amount, splToken, events = this.events) { - this.emitFunction(events.onBeforeCreateInstruction); - const transaction = await this.neonTransferTransaction(amount, splToken); - this.emitFunction(events.onBeforeSignTransaction); - try { - const signedTransaction = await this.solana.signTransaction(transaction); - const signature = await this.connection.sendRawTransaction(signedTransaction.serialize(), this.solanaOptions); - this.emitFunction(events.onSuccessSign, signature); - } - catch (e) { - this.emitFunction(events.onErrorSign, e); - } - } - // Neon -> Solana - async createSolanaTransfer(amount, splToken, events = this.events) { - const mintPubkey = new PublicKey(splToken.address_spl); - const walletPubkey = this.solanaWalletPubkey; - const associatedTokenPubkey = getAssociatedTokenAddressSync(mintPubkey, walletPubkey); - const solanaTransaction = await this.solanaTransferTransaction(walletPubkey, mintPubkey, associatedTokenPubkey); - const neonTransaction = await this.createNeonTransaction(this.neonWalletAddress, associatedTokenPubkey, splToken, amount); - neonTransaction.nonce = await this.web3.eth.getTransactionCount(this.neonWalletAddress); - this.emitFunction(events.onBeforeSignTransaction); - try { - const signedSolanaTransaction = await this.solana.signTransaction(solanaTransaction); - const signature = await this.connection.sendRawTransaction(signedSolanaTransaction.serialize(), this.solanaOptions); - const { transactionHash } = await this.web3.eth.sendTransaction(neonTransaction); - this.emitFunction(events.onSuccessSign, signature, transactionHash); - } - catch (error) { - this.emitFunction(events.onErrorSign, error); - } - } - async neonTransferTransaction(amount, splToken) { - const fullAmount = toFullAmount(amount, splToken.decimals); - const walletSigner = await solanaWalletSigner(this.web3, this.solanaWalletPubkey, this.neonWalletAddress); - const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), this.solanaWalletPubkey); - const climeData = climeTransactionData(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); - const signedTransaction = await neonClaimTransactionFromSigner(climeData, walletSigner, this.neonWalletAddress, splToken); - const { neonKeys, neonTransaction, legacyAccounts } = await createClaimInstruction(this.proxyApi, signedTransaction); - const transaction = await neonTransferMintTransaction(this.connection, this.proxyStatus, this.programId, this.solanaWalletPubkey, this.neonWalletAddress, walletSigner, neonKeys, legacyAccounts, neonTransaction, splToken, fullAmount, 111); - transaction.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash; - return transaction; - } - computeBudgetUtilsInstruction(programId) { - return createComputeBudgetUtilsInstruction(programId, this.proxyStatus); - } - computeBudgetHeapFrameInstruction(programId) { - return createComputeBudgetHeapFrameInstruction(programId, this.proxyStatus); - } - async createClaimInstruction(owner, from, to, splToken, emulateSigner, amount) { - const nonce = await this.web3.eth.getTransactionCount(emulateSigner.address); - const fullAmount = toFullAmount(amount, splToken.decimals); - const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), this.solanaWalletAddress); - const climeData = climeTransactionData(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); - const walletSigner = await solanaWalletSigner(this.web3, this.solanaWalletAddress, this.neonWalletAddress); - const signedTransaction = await neonClaimTransactionFromSigner(climeData, walletSigner, this.neonWalletAddress, splToken); - const { neonKeys, neonTransaction } = await createClaimInstruction(this.proxyApi, signedTransaction); - return { neonKeys, neonTransaction, emulateSigner, nonce }; - } - makeTrExecFromDataIx(neonAddress, neonRawTransaction, neonKeys) { - return createExecFromDataInstruction(this.solanaWalletPubkey, neonAddress, this.programId, neonRawTransaction, neonKeys, this.proxyStatus); - } - getCollateralPoolAddress(collateralPoolIndex) { - return collateralPoolAddress(this.programId, collateralPoolIndex); - } - async createNeonTransaction(neonWallet, solanaWallet, splToken, amount) { - return createMintNeonWeb3Transaction(this.web3, neonWallet, solanaWallet, splToken, amount); - } - async solanaTransferTransaction(walletPubkey, mintPubkey, associatedTokenPubkey) { - const transaction = createMintSolanaTransaction(walletPubkey, mintPubkey, associatedTokenPubkey, this.proxyStatus); - transaction.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash; - return transaction; - } - // #region Neon -> Solana - createAssociatedTokenAccountInstruction(associatedProgramId, programId, mint, associatedAccount, owner, payer) { - return createAssociatedTokenAccountInstruction(mint, associatedAccount, owner, payer); - } - async wrapSOLTransaction(amount, splToken) { - const transaction = await createWrapSOLTransaction(this.connection, this.solanaWalletPubkey, amount, splToken); - transaction.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash; - return transaction; - } - async unwrapSOLTransaction(amount, splToken) { - const transaction = await createUnwrapSOLTransaction(this.connection, this.solanaWalletPubkey, splToken); - transaction.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash; - return transaction; - } -} -//# sourceMappingURL=MintPortal.js.map \ No newline at end of file diff --git a/dist/core/deprecated/MintPortal.js.map b/dist/core/deprecated/MintPortal.js.map deleted file mode 100644 index b26110d8..00000000 --- a/dist/core/deprecated/MintPortal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MintPortal.js","sourceRoot":"","sources":["../../../src/core/deprecated/MintPortal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uCAAuC,EACvC,6BAA6B,EAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAe,SAAS,EAAuC,MAAM,iBAAiB,CAAC;AAE9F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CA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WAAW,GAAG,MAAM,0BAA0B,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;QACzG,WAAW,CAAC,eAAe,GAAG,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC,SAAS,CAAC;QACrF,OAAO,WAAW,CAAC;IACrB,CAAC;CACF"} \ No newline at end of file diff --git a/dist/core/deprecated/NeonPortal.js b/dist/core/deprecated/NeonPortal.js deleted file mode 100644 index 1f75bbe2..00000000 --- a/dist/core/deprecated/NeonPortal.js +++ /dev/null @@ -1,80 +0,0 @@ -import { InstructionService } from './InstructionService'; -import { createNeonDepositInstruction, createNeonTransferInstruction, neonTransactionData, solanaNEONTransferTransaction } from '../neon-transfer'; -import { authorityPoolAddress } from '../utils'; -/** - * @deprecated this code was deprecated and will remove in next releases. - * Please use other methods in neon-transfer.ts file - * For more examples see `examples` folder - */ -export class NeonPortal extends InstructionService { - // Solana -> Neon - async createNeonTransfer(amount, splToken, events = this.events) { - this.emitFunction(events.onBeforeCreateInstruction); - const transaction = await this.neonTransferTransaction(amount, splToken); - this.emitFunction(events.onBeforeSignTransaction); - try { - const signedTransaction = await this.solana.signTransaction(transaction); - const signature = await this.connection.sendRawTransaction(signedTransaction.serialize(), this.solanaOptions); - this.emitFunction(events.onSuccessSign, signature); - } - catch (error) { - this.emitFunction(events.onErrorSign, error); - } - } - // Neon -> Solana - async createSolanaTransfer(amount, splToken, events = this.events) { - this.emitFunction(events.onBeforeCreateInstruction); - const transaction = this.ethereumTransaction(amount, splToken); - this.emitFunction(events.onBeforeSignTransaction); - try { - const neonTransaction = await this.web3.eth.sendTransaction(transaction); - this.emitFunction(events.onSuccessSign, undefined, neonTransaction.transactionHash); - } - catch (error) { - this.emitFunction(events.onErrorSign, error); - } - } - async neonTransferTransaction(amount, token, serviceWallet, rewardAmount) { - const transaction = await solanaNEONTransferTransaction(this.solanaWalletPubkey, this.neonWalletAddress, this.programId, this.tokenMint, token, amount, 111, serviceWallet, rewardAmount); - transaction.recentBlockhash = (await this.connection.getLatestBlockhash('finalized')).blockhash; - return transaction; - } - createDepositInstruction(solanaPubkey, neonPubkey, depositPubkey, neonWalletAddress, serviceWallet) { - return createNeonDepositInstruction(solanaPubkey, neonPubkey, depositPubkey, neonWalletAddress, this.programId, this.tokenMint, serviceWallet); - } - neonTransferInstruction(solanaWallet, serviceWallet, rewardAmount) { - return createNeonTransferInstruction(this.tokenMint, solanaWallet, serviceWallet, rewardAmount); - } - getAuthorityPoolAddress() { - return authorityPoolAddress(this.programId); - } - createWithdrawEthTransactionData() { - return neonTransactionData(this.web3, this.solanaWalletPubkey); - } - ethereumTransaction(amount, token) { - const from = this.neonWalletAddress; - const to = this.neonContractAddress; - const value = `0x${BigInt(this.web3.utils.toWei(amount.toString(), 'ether')).toString(16)}`; - const data = this.createWithdrawEthTransactionData(); - return { from, to, value, data }; - } - createWithdrawWNeonTransaction(amount, address) { - const contract = this.neonWrapper2Contract(address); - return contract.methods.withdraw(amount).encodeABI(); - } - wNeonTransaction(amount, token) { - const from = this.neonWalletAddress; - const to = token.address; - const value = `0x0`; - const data = this.createWithdrawWNeonTransaction(this.web3.utils.toWei(amount.toString(), 'ether'), to); - return { from, to, value, data }; - } - neonTransaction(amount, token) { - const from = this.neonWalletAddress; - const to = token.address; - const value = `0x${BigInt(this.web3.utils.toWei(amount.toString(), 'ether')).toString(16)}`; - const data = this.createWithdrawEthTransactionData(); - return { from, to, value, data }; - } -} -//# sourceMappingURL=NeonPortal.js.map \ No newline at end of file diff --git a/dist/core/deprecated/NeonPortal.js.map b/dist/core/deprecated/NeonPortal.js.map deleted file mode 100644 index 253b1954..00000000 --- a/dist/core/deprecated/NeonPortal.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NeonPortal.js","sourceRoot":"","sources":["../../../src/core/deprecated/NeonPortal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM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AE,CAAC;IACnC,CAAC;IAED,eAAe,CAAC,MAAc,EAAE,KAAe;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC;QACpC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;QACzB,MAAM,KAAK,GAAG,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5F,MAAM,IAAI,GAAG,IAAI,CAAC,gCAAgC,EAAE,CAAC;QACrD,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACnC,CAAC;CACF"} \ No newline at end of file diff --git a/dist/core/deprecated/index.js.map b/dist/core/deprecated/index.js.map deleted file mode 100644 index e6fcd869..00000000 --- a/dist/core/deprecated/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/deprecated/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/core/index.js.map b/dist/core/index.js.map deleted file mode 100644 index 44e31839..00000000 --- a/dist/core/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"} \ No newline at end of file diff --git a/dist/core/mint-transfer.js b/dist/core/mint-transfer.js deleted file mode 100644 index ee854068..00000000 --- a/dist/core/mint-transfer.js +++ /dev/null @@ -1,279 +0,0 @@ -import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, Transaction, TransactionInstruction } from '@solana/web3.js'; -import { ASSOCIATED_TOKEN_PROGRAM_ID, createApproveInstruction, createCloseAccountInstruction, createSyncNativeInstruction, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID } from '@solana/spl-token'; -import { Buffer } from 'buffer'; -import { numberTo64BitLittleEndian, toBytesInt32, toFullAmount } from '../utils'; -import { COMPUTE_BUDGET_ID, NEON_COMPUTE_UNITS, NEON_HEAP_FRAME, NEON_STATUS_DEVNET_SNAPSHOT } from '../data'; -import { authAccountAddress, collateralPoolAddress, erc20ForSPLContract, neonBalanceProgramAddress, neonWalletProgramAddress, solanaWalletSigner } from './utils'; -export async function neonTransferMintWeb3Transaction(connection, web3, proxyApi, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, splToken, amount, chainId) { - const fullAmount = toFullAmount(amount, splToken.decimals); - const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), solanaWallet); - const climeData = climeTransactionData(web3, associatedTokenAddress, neonWallet, fullAmount); - const walletSigner = solanaWalletSigner(web3, solanaWallet, neonWallet); - const signedTransaction = await neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); - const { neonKeys, neonTransaction, legacyAccounts } = await createClaimInstruction(proxyApi, signedTransaction); - return neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, neonTransaction, splToken, fullAmount, chainId); -} -export async function neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, emulateSigner, neonKeys, legacyAccounts, neonTransaction, splToken, amount, chainId) { - const computedBudgetProgram = new PublicKey(COMPUTE_BUDGET_ID); - const [delegatePDA] = authAccountAddress(emulateSigner.address, neonEvmProgram, splToken); - const [neonWalletBalanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); - const [emulateSignerBalanceAddress] = neonBalanceProgramAddress(emulateSigner.address, neonEvmProgram, chainId); - const neonWalletBalanceAccount = await connection.getAccountInfo(neonWalletBalanceAddress); - const emulateSignerBalanceAccount = await connection.getAccountInfo(emulateSignerBalanceAddress); - const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), solanaWallet); - const transaction = new Transaction({ feePayer: solanaWallet }); - transaction.add(createComputeBudgetHeapFrameInstruction(computedBudgetProgram, proxyStatus)); - transaction.add(createApproveDepositInstruction(solanaWallet, delegatePDA, associatedTokenAddress, amount)); - if (!neonWalletBalanceAccount) { - transaction.add(createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonWallet, chainId)); - } - if (!emulateSignerBalanceAccount) { - transaction.add(createAccountBalanceInstruction(solanaWallet, neonEvmProgram, emulateSigner.address, chainId)); - } - for (const account of legacyAccounts) { - const instruction = await createAccountBalanceForLegacyAccountInstruction(connection, account, solanaWallet, neonEvmProgram, chainId); - if (instruction) { - transaction.add(instruction); - } - } - if (neonTransaction?.rawTransaction) { - transaction.add(createExecFromDataInstructionV2(solanaWallet, neonWallet, neonEvmProgram, neonTransaction.rawTransaction, neonKeys, proxyStatus, chainId)); - } - return transaction; -} -export function createComputeBudgetUtilsInstruction(programId, proxyStatus) { - const a = Buffer.from([0x00]); - const b = Buffer.from(toBytesInt32(parseInt(proxyStatus.NEON_COMPUTE_UNITS ?? NEON_COMPUTE_UNITS))); - const c = Buffer.from(toBytesInt32(0)); - const data = Buffer.concat([a, b, c]); - return new TransactionInstruction({ programId, data, keys: [] }); -} -export function createComputeBudgetHeapFrameInstruction(programId, proxyStatus) { - const a = Buffer.from([0x01]); - const b = Buffer.from(toBytesInt32(parseInt(proxyStatus.NEON_HEAP_FRAME ?? NEON_HEAP_FRAME))); - const data = Buffer.concat([a, b]); - return new TransactionInstruction({ programId, data, keys: [] }); -} -export function createApproveDepositInstruction(solanaWallet, neonPDAWallet, associatedToken, amount) { - return createApproveInstruction(associatedToken, neonPDAWallet, solanaWallet, amount); -} -export function createAccountV3Instruction(solanaWallet, neonPDAWallet, neonEvmProgram, neonWallet) { - const keys = [ - { pubkey: solanaWallet, isSigner: true, isWritable: true }, - { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, - { pubkey: neonPDAWallet, isSigner: false, isWritable: true } - ]; - const a = Buffer.from([40 /* EvmInstruction.CreateAccountV03 */]); - const b = Buffer.from(neonWallet.slice(2), 'hex'); - const data = Buffer.concat([a, b]); - return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); -} -export async function createAccountBalanceForLegacyAccountInstruction(connection, account, solanaWallet, neonEvmProgram, chainId) { - const accountAddress = new PublicKey(account.pubkey); - const accountInfo = await connection.getAccountInfo(accountAddress); - if (accountInfo) { - const neonAddress = `0x${accountInfo?.data.slice(1, 21).toString('hex')}`; - return createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonAddress, chainId); - } - return null; -} -export function createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonWallet, chainId) { - const [neonWalletAddress] = neonWalletProgramAddress(neonWallet, neonEvmProgram); - const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); - const keys = [ - { pubkey: solanaWallet, isSigner: true, isWritable: true }, - { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, - { pubkey: balanceAddress, isSigner: false, isWritable: true }, - { pubkey: neonWalletAddress, isSigner: false, isWritable: true } - ]; - const a = Buffer.from([48 /* EvmInstruction.AccountCreateBalance */]); - const b = Buffer.from(neonWallet.slice(2), 'hex'); - const c = numberTo64BitLittleEndian(chainId); - const data = Buffer.concat([a, b, c]); - return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); -} -export function climeTransactionData(web3, associatedToken, neonWallet, amount) { - const claimTo = erc20ForSPLContract(web3).methods.claimTo(associatedToken.toBuffer(), neonWallet, amount); - return claimTo.encodeABI(); -} -export async function neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken) { - const transaction = { - data: climeData, - gas: `0x5F5E100`, - gasPrice: `0x0`, - from: neonWallet, - to: splToken.address // contract address - }; - return walletSigner.signTransaction(transaction); -} -export async function createClaimInstruction(proxyApi, neonTransaction) { - try { - let neonEmulate; - const legacyAccounts = []; - if (neonTransaction.rawTransaction) { - neonEmulate = await proxyApi.neonEmulate([neonTransaction.rawTransaction.slice(2)]); - } - const accountsMap = new Map(); - if (neonEmulate) { - const { accounts = [], solana_accounts = [] } = neonEmulate; - for (const account of accounts) { - const key = account['account']; - accountsMap.set(key, { pubkey: new PublicKey(key), isSigner: false, isWritable: true }); - if (account['contract']) { - const key = account['contract']; - accountsMap.set(key, { pubkey: new PublicKey(key), isSigner: false, isWritable: true }); - } - } - for (const account of solana_accounts) { - const { pubkey, is_legacy, is_writable } = account; - accountsMap.set(pubkey, { - pubkey: new PublicKey(pubkey), - isSigner: false, - isWritable: is_writable - }); - if (is_legacy) { - legacyAccounts.push(account); - } - } - } - return { neonKeys: Array.from(accountsMap.values()), neonTransaction, legacyAccounts }; - } - catch (e) { - console.log(e); - } - // @ts-ignore - return { neonKeys: [], neonTransaction: null }; -} -export function createExecFromDataInstruction(solanaWallet, neonPDAWallet, neonEvmProgram, neonRawTransaction, neonKeys, proxyStatus) { - const count = Number(proxyStatus.NEON_POOL_COUNT); - const treasuryPoolIndex = Math.floor(Math.random() * count) % count; - const [treasuryPoolAddress] = collateralPoolAddress(neonEvmProgram, treasuryPoolIndex); - const a = Buffer.from([50 /* EvmInstruction.TransactionExecuteFromInstruction */]); - const b = Buffer.from(toBytesInt32(treasuryPoolIndex)); - const c = Buffer.from(neonRawTransaction.slice(2), 'hex'); - const data = Buffer.concat([a, b, c]); - const keys = [ - { pubkey: solanaWallet, isSigner: true, isWritable: true }, - { pubkey: treasuryPoolAddress, isSigner: false, isWritable: true }, - { pubkey: neonPDAWallet, isSigner: false, isWritable: true }, - { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, - { pubkey: neonEvmProgram, isSigner: false, isWritable: false }, - ...neonKeys - ]; - return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); -} -export function createExecFromDataInstructionV2(solanaWallet, neonWallet, neonEvmProgram, neonRawTransaction, neonKeys, proxyStatus, chainId) { - const count = Number(proxyStatus.NEON_POOL_COUNT ?? NEON_STATUS_DEVNET_SNAPSHOT.NEON_POOL_COUNT); - const treasuryPoolIndex = Math.floor(Math.random() * count) % count; - const [balanceAccount] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); - const [treasuryPoolAddress] = collateralPoolAddress(neonEvmProgram, treasuryPoolIndex); - const a = Buffer.from([50 /* EvmInstruction.TransactionExecuteFromInstruction */]); - const b = Buffer.from(toBytesInt32(treasuryPoolIndex)); - const c = Buffer.from(neonRawTransaction.slice(2), 'hex'); - const data = Buffer.concat([a, b, c]); - const keys = [ - { pubkey: solanaWallet, isSigner: true, isWritable: true }, - { pubkey: treasuryPoolAddress, isSigner: false, isWritable: true }, - { pubkey: balanceAccount, isSigner: false, isWritable: true }, - { pubkey: SystemProgram.programId, isSigner: false, isWritable: true }, - ...neonKeys - ]; - return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); -} -export async function createMintNeonWeb3Transaction(web3, neonWallet, associatedToken, splToken, amount, gasLimit = 5e4) { - const data = mintNeonTransactionData(web3, associatedToken, splToken, amount); - const transaction = createMintNeonTransaction(neonWallet, splToken, data); - transaction.gasPrice = await web3.eth.getGasPrice(); - transaction.gas = await web3.eth.estimateGas(transaction); - transaction.nonce = (await web3.eth.getTransactionCount(neonWallet)); - // @ts-ignore - transaction['gasLimit'] = transaction.gas > gasLimit ? transaction.gas + 1e4 : gasLimit; - return transaction; -} -export function mintNeonTransactionData(web3, associatedToken, splToken, amount) { - const fullAmount = toFullAmount(amount, splToken.decimals); - return erc20ForSPLContract(web3).methods.transferSolana(associatedToken.toBuffer(), fullAmount).encodeABI(); -} -export function createMintNeonTransaction(neonWallet, splToken, data) { - return { data, from: neonWallet, to: splToken.address, value: `0x0` }; -} -export function createMintSolanaTransaction(solanaWallet, tokenMint, associatedToken, proxyStatus) { - const computedBudgetProgram = new PublicKey(COMPUTE_BUDGET_ID); - const transaction = new Transaction({ feePayer: solanaWallet }); - // transaction.add(createComputeBudgetUtilsInstruction(computedBudgetProgram, proxyStatus)); - transaction.add(createComputeBudgetHeapFrameInstruction(computedBudgetProgram, proxyStatus)); - transaction.add(createAssociatedTokenAccountInstruction(tokenMint, associatedToken, solanaWallet, solanaWallet)); - return transaction; -} -// #region Neon -> Solana -export function createAssociatedTokenAccountInstruction(tokenMint, associatedAccount, owner, payer, associatedProgramId = ASSOCIATED_TOKEN_PROGRAM_ID, programId = TOKEN_PROGRAM_ID) { - const data = Buffer.from([0x01]); - const keys = [ - { pubkey: payer, isSigner: true, isWritable: true }, - { pubkey: associatedAccount, isSigner: false, isWritable: true }, - { pubkey: owner, isSigner: false, isWritable: false }, - { pubkey: tokenMint, isSigner: false, isWritable: false }, - { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, - { pubkey: programId, isSigner: false, isWritable: false }, - { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false } - ]; - return new TransactionInstruction({ programId: associatedProgramId, keys, data }); -} -export async function createWrapSOLTransaction(connection, solanaWallet, amount, splToken) { - const tokenMint = new PublicKey(splToken.address_spl); - const lamports = toFullAmount(amount, splToken.decimals); - const associatedToken = getAssociatedTokenAddressSync(tokenMint, solanaWallet); - const wSOLAccount = await connection.getAccountInfo(associatedToken); - const transaction = new Transaction({ feePayer: solanaWallet }); - const instructions = []; - if (!wSOLAccount) { - instructions.push(createAssociatedTokenAccountInstruction(tokenMint, associatedToken, solanaWallet, solanaWallet)); - } - instructions.push(SystemProgram.transfer({ - fromPubkey: solanaWallet, - toPubkey: associatedToken, - lamports - })); - instructions.push(createSyncNativeInstruction(associatedToken, TOKEN_PROGRAM_ID)); - transaction.add(...instructions); - return transaction; -} -export async function createUnwrapSOLTransaction(connection, solanaWallet, splToken) { - const tokenMint = new PublicKey(splToken.address_spl); - const associatedToken = getAssociatedTokenAddressSync(tokenMint, solanaWallet); - const wSOLAccount = await connection.getAccountInfo(associatedToken); - if (!wSOLAccount) { - throw new Error(`Error: ${associatedToken.toBase58()} haven't created account...`); - } - const transaction = new Transaction({ feePayer: solanaWallet }); - const instructions = []; - instructions.push(createCloseAccountInstruction(associatedToken, solanaWallet, solanaWallet)); - transaction.add(...instructions); - return transaction; -} -export async function createWrapAndTransferSOLTransactionWeb3(connection, web3, proxyApi, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, splToken, amount, chainId = 111) { - const instructions = []; - const transaction = new Transaction({ feePayer: solanaWallet }); - const tokenMint = new PublicKey(splToken.address_spl); - const fullAmount = toFullAmount(amount, splToken.decimals); - const associatedTokenAddress = getAssociatedTokenAddressSync(tokenMint, solanaWallet); - const wSOLAccount = await connection.getAccountInfo(associatedTokenAddress); - const climeData = climeTransactionData(web3, associatedTokenAddress, neonWallet, fullAmount); - const walletSigner = solanaWalletSigner(web3, solanaWallet, neonWallet); - const signedTransaction = await neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); - const { neonKeys, neonTransaction, legacyAccounts } = await createClaimInstruction(proxyApi, signedTransaction); - const mintTransaction = await neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, neonTransaction, splToken, fullAmount, chainId); - if (!wSOLAccount) { - instructions.push(createAssociatedTokenAccountInstruction(tokenMint, associatedTokenAddress, solanaWallet, solanaWallet)); - } - instructions.push(SystemProgram.transfer({ - fromPubkey: solanaWallet, - toPubkey: associatedTokenAddress, - lamports: fullAmount - })); - instructions.push(createSyncNativeInstruction(associatedTokenAddress, TOKEN_PROGRAM_ID)); - transaction.add(...instructions); - transaction.add(...mintTransaction.instructions); - return transaction; -} -//# sourceMappingURL=mint-transfer.js.map \ No newline at end of file diff --git a/dist/core/mint-transfer.js.map b/dist/core/mint-transfer.js.map deleted file mode 100644 index 0f8a7bf0..00000000 --- a/dist/core/mint-transfer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"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ACxE,MAAM,iBAAiB,GAAG,MAAM,8BAA8B,CAAC,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC9G,MAAM,EACJ,QAAQ,EACR,eAAe,EACf,cAAc,EACf,GAAG,MAAM,sBAAsB,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;IAC9D,MAAM,eAAe,GAAG,MAAM,2BAA2B,CAAC,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IAErN,IAAI,CAAC,WAAW,EAAE;QAChB,YAAY,CAAC,IAAI,CAAC,uCAAuC,CAAC,SAAS,EAAE,sBAAsB,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC;KAC3H;IAED,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;QACvC,UAAU,EAAE,YAAY;QACxB,QAAQ,EAAE,sBAAsB;QAChC,QAAQ,EAAE,UAAU;KACrB,CAAC,CAAC,CAAC;IACJ,YAAY,CAAC,IAAI,CAAC,2BAA2B,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACzF,WAAW,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC;IACjC,WAAW,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAEjD,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/dist/core/multy-transfer.js b/dist/core/multy-transfer.js deleted file mode 100644 index 9364d48e..00000000 --- a/dist/core/multy-transfer.js +++ /dev/null @@ -1,16 +0,0 @@ -import { PublicKey } from '@solana/web3.js'; -import { createApproveInstruction, getAssociatedTokenAddressSync } from '@solana/spl-token'; -import { neonBalanceProgramAddress } from './utils'; -import { toFullAmount } from '../utils'; -import { createNeonDepositToBalanceInstruction } from './neon-transfer'; -import { createWrapSOLTransaction } from './mint-transfer'; -export async function solanaSOLTransferTransaction(connection, solanaWallet, neonWallet, neonEvmProgram, neonTokenMint, token, amount, chainId = 111) { - const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); - const fullAmount = toFullAmount(amount, token.decimals); - const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(token.address_spl), solanaWallet); - const transaction = await createWrapSOLTransaction(connection, solanaWallet, amount, token); - transaction.add(createApproveInstruction(associatedTokenAddress, balanceAddress, solanaWallet, fullAmount)); - transaction.add(createNeonDepositToBalanceInstruction(chainId, solanaWallet, associatedTokenAddress, neonWallet, neonEvmProgram, neonTokenMint)); - return transaction; -} -//# sourceMappingURL=multy-transfer.js.map \ No newline at end of file diff --git a/dist/core/multy-transfer.js.map b/dist/core/multy-transfer.js.map deleted file mode 100644 index 77339265..00000000 --- a/dist/core/multy-transfer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"multy-transfer.js","sourceRoot":"","sources":["../../src/core/multy-transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAe,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAE5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,qCAAqC,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,UAAsB,EAAE,YAAuB,EAAE,UAAuB,EAAE,cAAyB,EAAE,aAAwB,EAAE,KAAe,EAAE,MAAc,EAAE,OAAO,GAAG,GAAG;IAC9N,MAAM,CAAC,cAAc,CAAC,GAAG,yBAAyB,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IACxF,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxD,MAAM,sBAAsB,GAAG,6BAA6B,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,CAAC;IAC7G,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAAC,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE5F,WAAW,CAAC,GAAG,CAAC,wBAAwB,CAAC,sBAAsB,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5G,WAAW,CAAC,GAAG,CAAC,qCAAqC,CAAC,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC,CAAC;IAEjJ,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/dist/core/neon-transfer.js.map b/dist/core/neon-transfer.js.map deleted file mode 100644 index 80d08af0..00000000 --- a/dist/core/neon-transfer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"neon-transfer.js","sourceRoot":"","sources":["../../src/core/neon-transfer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAChG,OAAO,EACL,wBAAwB,EACxB,6BAA6B,EAC7B,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,yBAAyB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,E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rD,MAAM,WAAW,GAAG,mBAAmB,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAChE,WAAW,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;IACpD,WAAW,CAAC,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC1D,aAAa;IACb,WAAW,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;IACxF,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/dist/core/utils/accounts.js.map b/dist/core/utils/accounts.js.map deleted file mode 100644 index 16a96dbc..00000000 --- a/dist/core/utils/accounts.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../src/core/utils/accounts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,MAAM,UAAU,kBAAkB,CAAC,IAAU,EAAE,YAAuB,EAAE,UAAkB;IACxF,MAAM,uBAAuB,GAAG,KAAK,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC/F,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;AACxE,CAAC"} \ No newline at end of file diff --git a/dist/core/utils/addresses.js.map b/dist/core/utils/addresses.js.map deleted file mode 100644 index c6a36e72..00000000 --- a/dist/core/utils/addresses.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/core/utils/addresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,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O,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;AACxG,CAAC"} \ No newline at end of file diff --git a/dist/core/utils/contracts.d.ts b/dist/core/utils/contracts.d.ts deleted file mode 100644 index 3ac8ba76..00000000 --- a/dist/core/utils/contracts.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Contract } from 'web3-eth-contract'; -import Web3 from 'web3'; -export declare function erc20ForSPLContract(web3: Web3): Contract; -export declare function neonWrapperContract(web3: Web3): Contract; -export declare function neonWrapper2Contract(web3: Web3, address: string): Contract; diff --git a/dist/core/utils/contracts.js.map b/dist/core/utils/contracts.js.map deleted file mode 100644 index 1e465d08..00000000 --- a/dist/core/utils/contracts.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/core/utils/contracts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,UAAU,mBAAmB,CAAC,IAAU;IAC5C,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAqB,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAU;IAC5C,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,cAA2B,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAU,EAAE,OAAe;IAC9D,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,eAA4B,EAAE,OAAO,CAAC,CAAC;AACtE,CAAC"} \ No newline at end of file diff --git a/dist/core/utils/index.js.map b/dist/core/utils/index.js.map deleted file mode 100644 index 1fdda4c1..00000000 --- a/dist/core/utils/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/dist/data/abi/erc20.js.map b/dist/data/abi/erc20.js.map deleted file mode 100644 index cf495355..00000000 --- a/dist/data/abi/erc20.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../src/data/abi/erc20.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB;QACE,QAAQ,EAAE;YACR;gBACE,cAAc,EAAE,QAAQ;gBACxB,MAAM,EAAE,OAAO;gBACf,MAAM,EAAE,QAAQ;aACjB;YACD;gBACE,cAAc,EAAE,QAAQ;gBACxB,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,QAAQ;aACjB;YACD;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,YAAY;gBACpB,MAAM,EAAE,SAAS;aAClB;SACF;QACD,iBAAiB,EAAE,YAAY;QAC/B,MAAM,EAAE,aAAa;KACtB;IACD;QACE,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE;YACR;gBACE,SAAS,EAAE,IAAI;gBACf,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,OAAO;gBACf,MAAM,EAAE,SAAS;aAClB;YACD;gBACE,SAAS,EAAE,IAAI;gBACf,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,SAAS;gBACjB,MAAM,EAAE,SAAS;aAClB;YACD;gBACE,SAAS,EAAE,KAAK;gBAChB,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,QAAQ;gBAChB,MAAM,EAAE,SAAS;aAClB;SACF;QACD,MAAM,EAAE,UAAU;QAClB,MAAM,EAAE,OAAO;KAChB;IACD;QACE,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE;YACR;gBACE,SAAS,EAAE,IAAI;gBACf,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,OAAO;gBACf,MAAM,EAAE,SAAS;aAClB;YACD;gBACE,SA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,EAAE,SAAS;aAClB;YACD;gBACE,cAAc,EAAE,QAAQ;gBACxB,MAAM,EAAE,QAAQ;gBAChB,MAAM,EAAE,QAAQ;aACjB;SACF;QACD,MAAM,EAAE,gBAAgB;QACxB,SAAS,EAAE;YACT;gBACE,cAAc,EAAE,MAAM;gBACtB,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,MAAM;aACf;SACF;QACD,iBAAiB,EAAE,YAAY;QAC/B,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,QAAQ,CAAC"} \ No newline at end of file diff --git a/dist/data/abi/index.js.map b/dist/data/abi/index.js.map deleted file mode 100644 index ae8935d2..00000000 --- a/dist/data/abi/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data/abi/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"} \ No newline at end of file diff --git a/dist/data/abi/neonWrapper.js.map b/dist/data/abi/neonWrapper.js.map deleted file mode 100644 index 75e365ee..00000000 --- a/dist/data/abi/neonWrapper.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"neonWrapper.js","sourceRoot":"","sources":["../../../src/data/abi/neonWrapper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;QACE,QAAQ,EAAE;YACR;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,SAAS;aAClB;SACF;QACD,MAAM,EAAE,UAAU;QAClB,SAAS,EAAE;YACT;gBACE,cAAc,EAAE,MAAM;gBACtB,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,MAAM;aACf;SACF;QACD,iBAAiB,EAAE,SAAS;QAC5B,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/data/abi/neonWrapper2.js.map b/dist/data/abi/neonWrapper2.js.map deleted file mode 100644 index 82cd536d..00000000 --- a/dist/data/abi/neonWrapper2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"neonWrapper2.js","sourceRoot":"","sources":["../../../src/data/abi/neonWrapper2.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;QAC9B,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QAC7C,SAAS,EAAE,KAAK;QAChB,iBAAiB,EAAE,MAAM;QACzB,MAAM,EAAE,UAAU;KACnB,EAAE;QACD,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QACtF,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAC3C,SAAS,EAAE,KAAK;QAChB,iBAAiB,EAAE,YAAY;QAC/B,MAAM,EAAE,UAAU;KACnB,EAAE;QACD,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,aAAa;QACrB,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAC9C,SAAS,EAAE,KAAK;QAChB,iBAAiB,EAAE,MAAM;QACzB,MAAM,EAAE,UAAU;KACnB,EAAE;QACD,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE;gBAC/C,MAAM,EAAE,KAAK;gBAC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ode 100644 index 378e82c4..00000000 --- a/dist/data/constants.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/data/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,6BAA6B,GAAG,4CAA4C,CAAC;AAC1F,MAAM,CAAC,MAAM,4BAA4B,GAAG,4CAA4C,CAAC;AACzF,MAAM,CAAC,MAAM,8BAA8B,GAAG,4CAA4C,CAAC;AAC3F,MAAM,CAAC,MAAM,8BAA8B,GAAG,4CAA4C,CAAC;AAE3F,MAAM,CAAC,MAAM,cAAc,GAAG,6CAA6C,CAAC;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,6CAA6C,CAAC;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAG,6CAA6C,CAAC;AACvF,MAAM,CAAC,MAAM,iBAAiB,GAAG,6CAA6C,CAAC;AAE/E,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AACxC,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAC3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,8CAA8C,CAAC;AACrF,MAAM,CAAC,MAAM,qBAAqB,GAAG,8CAA8C,CAAC;AACpF,MAAM,CAAC,MAAM,uBAAuB,GAAG,6CAA6C,CAAC;AACrF,MAAM,CAAC,MAAM,sBAAsB,GAAG,6CAA6C,CAAC"} \ No newline at end of file diff --git a/dist/data/index.js.map b/dist/data/index.js.map deleted file mode 100644 index 814498d1..00000000 --- a/dist/data/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/data/proxy.js.map b/dist/data/proxy.js.map deleted file mode 100644 index 45035ed2..00000000 --- a/dist/data/proxy.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/data/proxy.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,4BAA4B,GAAsB;IAC7D,yBAAyB,EAAE,GAAG;IAC9B,mBAAmB,EAAE,GAAG;IACxB,aAAa,EAAE,WAAW;IAC1B,8BAA8B,EAAE,QAAQ;IACxC,yBAAyB,EAAE,QAAQ;IACnC,kBAAkB,EAAE,QAAQ;IAC5B,iCAAiC,EAAE,GAAG;IACtC,kBAAkB,EAAE,KAAK;IACzB,oCAAoC,EAAE,MAAM;IAC5C,eAAe,EAAE,QAAQ;IACzB,oBAAoB,EAAE,KAAK;IAC3B,4BAA4B,EAAE,IAAI;IAClC,uBAAuB,EAAE,MAAM;IAC/B,wBAAwB,EAAE,MAAM;IAChC,gBAAgB,EAAE,OAAO;IACzB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,eAAe;IAC/B,iCAAiC,EAAE,GAAG;IACtC,aAAa,EAAE,0CAA0C;IACzD,iBAAiB,EAAE,GAAG;IACtB,gBAAgB,EAAE,MAAM;IACxB,wCAAwC,EAAE,IAAI;IAC9C,eAAe,EAAE,6CAA6C;IAC9D,wBAAwB,EAAE,GAAG;IAC7B,wBAAwB,EAAE,KAAK;IAC/B,uBAAuB,EAAE,eAAe;IACxC,WAAW,EAAE,6CAA6C;CAC3D,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAsB;IAC5D,yBAAyB,EAAE,GAAG;IAC9B,WAAW,EAAE,6CAA6C;IAC1D,iCAAiC,EAAE,GAAG;IACtC,kBAAkB,EAAE,KAAK;IACzB,oCAAoC,EAAE,MAAM;IAC5C,oBAAoB,EAAE,KAAK;IAC3B,4BAA4B,EAAE,IAAI;IAClC,wBAAwB,EAAE,MAAM;IAChC,wCAAwC,EAAE,IAAI;IAC9C,wBAAwB,EAAE,KAAK;IAC/B,uBAAuB,EAAE,eAAe;CACzC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAe,CAAC;QACrD,UAAU,EAAE,MAAM;QAClB,UAAU,EAAE,8CAA8C;QAC1D,cAAc,EAAE,WAAW;KAC5B,EAAE;QACD,UAAU,EAAE,KAAK;QACjB,UAAU,EAAE,6CAA6C;QACzD,cAAc,EAAE,WAAW;KAC5B,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAA6B,CAAC;AACjE,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,4BAA4B,CAAC,CAAC;AACjE,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/api/index.d.ts b/dist/esm/api/index.js similarity index 100% rename from dist/api/index.d.ts rename to dist/esm/api/index.js diff --git a/dist/esm/api/neon-proxy-rpc.js b/dist/esm/api/neon-proxy-rpc.js new file mode 100644 index 00000000..1d9eaa7d --- /dev/null +++ b/dist/esm/api/neon-proxy-rpc.js @@ -0,0 +1,61 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +export class NeonProxyRpcApi { + constructor(params) { + var _a, _b; + this.neonProxyRpcApi = ''; + this.solanaRpcApi = ''; + this.neonProxyRpcApi = (_a = params.neonProxyRpcApi) !== null && _a !== void 0 ? _a : ''; + this.solanaRpcApi = (_b = params.solanaRpcApi) !== null && _b !== void 0 ? _b : ''; + } + rpc(url, method, params = []) { + return __awaiter(this, void 0, void 0, function* () { + const id = Date.now(); + const body = { id, jsonrpc: '2.0', method, params }; + console.log('POST', url, JSON.stringify(body)); + const response = yield fetch(url, { + method: 'POST', + mode: 'cors', + body: JSON.stringify(body) + }); + return yield response.json(); + }); + } + proxy(method, params = []) { + return __awaiter(this, void 0, void 0, function* () { + return this.rpc(this.neonProxyRpcApi, method, params); + }); + } + solana(method, params = []) { + return __awaiter(this, void 0, void 0, function* () { + return this.rpc(this.solanaRpcApi, method, params); + }); + } + neonEmulate(params = []) { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_emulate', params).then(d => d.result); + }); + } + evmParams() { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_getEvmParams', []).then(d => d.result); + }); + } + gasTokenList() { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_getGasTokenList', []).then(d => d.result); + }); + } + nativeTokenList() { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_getNativeTokenList', []).then(d => d.result); + }); + } +} diff --git a/dist/core/deprecated/InstructionService.js b/dist/esm/core/deprecated/InstructionService.js similarity index 76% rename from dist/core/deprecated/InstructionService.js rename to dist/esm/core/deprecated/InstructionService.js index 0460034b..16ff98a4 100644 --- a/dist/core/deprecated/InstructionService.js +++ b/dist/esm/core/deprecated/InstructionService.js @@ -1,3 +1,12 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; import { PublicKey } from '@solana/web3.js'; import { createApproveInstruction, getAssociatedTokenAddressSync } from '@solana/spl-token'; import { toFullAmount } from '../../utils'; @@ -15,9 +24,11 @@ export class InstructionService { return new PublicKey(this.proxyStatus.NEON_EVM_ID); } get tokenMint() { - return new PublicKey(this.proxyStatus.NEON_TOKEN_MINT ?? NEON_TOKEN_MINT_DEVNET); + var _a; + return new PublicKey((_a = this.proxyStatus.NEON_TOKEN_MINT) !== null && _a !== void 0 ? _a : NEON_TOKEN_MINT_DEVNET); } constructor(options) { + var _a; this.emitFunction = (functionName, ...args) => { if (typeof functionName === 'function') { functionName(...args); @@ -30,7 +41,7 @@ export class InstructionService { this.neonWalletAddress = options.neonWalletAddress || ''; this.neonContractAddress = options.neonContractAddress || ''; this.connection = options.connection; - this.solanaOptions = options.solanaOptions ?? { skipPreflight: false }; + this.solanaOptions = (_a = options.solanaOptions) !== null && _a !== void 0 ? _a : { skipPreflight: false }; this.events = { onBeforeCreateInstruction: options.onBeforeCreateInstruction || noop, onCreateNeonAccountInstruction: options.onCreateNeonAccountInstruction || noop, @@ -67,8 +78,10 @@ export class InstructionService { authAccountAddress(neonWallet, token) { return authAccountAddress(neonWallet, this.programId, token); } - async getNeonAccount(neonAssociatedKey) { - return this.connection.getAccountInfo(neonAssociatedKey); + getNeonAccount(neonAssociatedKey) { + return __awaiter(this, void 0, void 0, function* () { + return this.connection.getAccountInfo(neonAssociatedKey); + }); } createAccountV3Instruction(solanaWallet, neonWalletPDA, neonWallet) { return createAccountV3Instruction(solanaWallet, neonWalletPDA, this.programId, neonWallet); @@ -93,4 +106,3 @@ export class InstructionService { }; } } -//# sourceMappingURL=InstructionService.js.map \ No newline at end of file diff --git a/dist/esm/core/deprecated/MintPortal.js b/dist/esm/core/deprecated/MintPortal.js new file mode 100644 index 00000000..9fd0f931 --- /dev/null +++ b/dist/esm/core/deprecated/MintPortal.js @@ -0,0 +1,126 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { createAssociatedTokenAccountInstruction, getAssociatedTokenAddressSync } from '@solana/spl-token'; +import { PublicKey } from '@solana/web3.js'; +import { toFullAmount } from '../../utils'; +import { climeTransactionDataWeb3, createClaimInstruction, createComputeBudgetHeapFrameInstruction, createComputeBudgetUtilsInstruction, createExecFromDataInstruction, createMintNeonTransactionWeb3, createMintSolanaTransaction, createUnwrapSOLTransaction, createWrapSOLTransaction, neonClaimTransactionFromSigner, neonTransferMintTransaction } from '../mint-transfer'; +import { collateralPoolAddress, solanaWalletSigner } from '../utils'; +import { InstructionService } from './InstructionService'; +/** + * @deprecated this code was deprecated and will remove in next releases. + * Please use other methods in mint-transfer.ts file + * For more examples see `examples` folder + */ +export class MintPortal extends InstructionService { + // Solana -> Neon + createNeonTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + this.emitFunction(events.onBeforeCreateInstruction); + const transaction = yield this.neonTransferTransaction(amount, splToken); + this.emitFunction(events.onBeforeSignTransaction); + try { + const signedTransaction = yield this.solana.signTransaction(transaction); + const signature = yield this.connection.sendRawTransaction(signedTransaction.serialize(), this.solanaOptions); + this.emitFunction(events.onSuccessSign, signature); + } + catch (e) { + this.emitFunction(events.onErrorSign, e); + } + }); + } + // Neon -> Solana + createSolanaTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + const mintPubkey = new PublicKey(splToken.address_spl); + const walletPubkey = this.solanaWalletPubkey; + const associatedTokenPubkey = getAssociatedTokenAddressSync(mintPubkey, walletPubkey); + const solanaTransaction = yield this.solanaTransferTransaction(walletPubkey, mintPubkey, associatedTokenPubkey); + const neonTransaction = yield this.createNeonTransaction(this.neonWalletAddress, associatedTokenPubkey, splToken, amount); + neonTransaction.nonce = yield this.web3.eth.getTransactionCount(this.neonWalletAddress); + this.emitFunction(events.onBeforeSignTransaction); + try { + const signedSolanaTransaction = yield this.solana.signTransaction(solanaTransaction); + const signature = yield this.connection.sendRawTransaction(signedSolanaTransaction.serialize(), this.solanaOptions); + const { transactionHash } = yield this.web3.eth.sendTransaction(neonTransaction); + this.emitFunction(events.onSuccessSign, signature, transactionHash); + } + catch (error) { + this.emitFunction(events.onErrorSign, error); + } + }); + } + neonTransferTransaction(amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const fullAmount = toFullAmount(amount, splToken.decimals); + const walletSigner = yield solanaWalletSigner(this.web3, this.solanaWalletPubkey, this.neonWalletAddress); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), this.solanaWalletPubkey); + const climeData = climeTransactionDataWeb3(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, this.neonWalletAddress, splToken); + const { neonKeys, legacyAccounts } = yield createClaimInstruction(this.proxyApi, signedTransaction); + const transaction = yield neonTransferMintTransaction(this.connection, this.proxyStatus, this.programId, this.solanaWalletPubkey, this.neonWalletAddress, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, 111); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } + computeBudgetUtilsInstruction(programId) { + return createComputeBudgetUtilsInstruction(programId, this.proxyStatus); + } + computeBudgetHeapFrameInstruction(programId) { + return createComputeBudgetHeapFrameInstruction(programId, this.proxyStatus); + } + createClaimInstruction(owner, from, to, splToken, emulateSigner, amount) { + return __awaiter(this, void 0, void 0, function* () { + const nonce = yield this.web3.eth.getTransactionCount(emulateSigner.address); + const fullAmount = toFullAmount(amount, splToken.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), this.solanaWalletAddress); + const climeData = climeTransactionDataWeb3(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); + const walletSigner = yield solanaWalletSigner(this.web3, this.solanaWalletAddress, this.neonWalletAddress); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, this.neonWalletAddress, splToken); + const { neonKeys, neonTransaction } = yield createClaimInstruction(this.proxyApi, signedTransaction); + return { neonKeys, neonTransaction: signedTransaction, emulateSigner, nonce }; + }); + } + makeTrExecFromDataIx(neonAddress, neonRawTransaction, neonKeys) { + return createExecFromDataInstruction(this.solanaWalletPubkey, neonAddress, this.programId, neonRawTransaction, neonKeys, this.proxyStatus); + } + getCollateralPoolAddress(collateralPoolIndex) { + return collateralPoolAddress(this.programId, collateralPoolIndex); + } + createNeonTransaction(neonWallet, solanaWallet, splToken, amount) { + return __awaiter(this, void 0, void 0, function* () { + return createMintNeonTransactionWeb3(this.web3, neonWallet, solanaWallet, splToken, amount); + }); + } + solanaTransferTransaction(walletPubkey, mintPubkey, associatedTokenPubkey) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = createMintSolanaTransaction(walletPubkey, mintPubkey, associatedTokenPubkey, this.proxyStatus); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } + // #region Neon -> Solana + createAssociatedTokenAccountInstruction(associatedProgramId, programId, mint, associatedAccount, owner, payer) { + return createAssociatedTokenAccountInstruction(mint, associatedAccount, owner, payer); + } + wrapSOLTransaction(amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = yield createWrapSOLTransaction(this.connection, this.solanaWalletPubkey, amount, splToken); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } + unwrapSOLTransaction(amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = yield createUnwrapSOLTransaction(this.connection, this.solanaWalletPubkey, splToken); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } +} diff --git a/dist/esm/core/deprecated/NeonPortal.js b/dist/esm/core/deprecated/NeonPortal.js new file mode 100644 index 00000000..7f7e529a --- /dev/null +++ b/dist/esm/core/deprecated/NeonPortal.js @@ -0,0 +1,94 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { InstructionService } from './InstructionService'; +import { createNeonDepositInstruction, createNeonTransferInstruction, neonTransactionDataWeb3, solanaNEONTransferTransaction } from '../neon-transfer'; +import { authorityPoolAddress } from '../utils'; +/** + * @deprecated this code was deprecated and will remove in next releases. + * Please use other methods in neon-transfer.ts file + * For more examples see `examples` folder + */ +export class NeonPortal extends InstructionService { + // Solana -> Neon + createNeonTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + this.emitFunction(events.onBeforeCreateInstruction); + const transaction = yield this.neonTransferTransaction(amount, splToken); + this.emitFunction(events.onBeforeSignTransaction); + try { + const signedTransaction = yield this.solana.signTransaction(transaction); + const signature = yield this.connection.sendRawTransaction(signedTransaction.serialize(), this.solanaOptions); + this.emitFunction(events.onSuccessSign, signature); + } + catch (error) { + this.emitFunction(events.onErrorSign, error); + } + }); + } + // Neon -> Solana + createSolanaTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + this.emitFunction(events.onBeforeCreateInstruction); + const transaction = this.ethereumTransaction(amount, splToken); + this.emitFunction(events.onBeforeSignTransaction); + try { + const neonTransaction = yield this.web3.eth.sendTransaction(transaction); + this.emitFunction(events.onSuccessSign, undefined, neonTransaction.transactionHash); + } + catch (error) { + this.emitFunction(events.onErrorSign, error); + } + }); + } + neonTransferTransaction(amount, token, serviceWallet, rewardAmount) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = yield solanaNEONTransferTransaction(this.solanaWalletPubkey, this.neonWalletAddress, this.programId, this.tokenMint, token, amount, 111, serviceWallet, rewardAmount); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash('finalized')).blockhash; + return transaction; + }); + } + createDepositInstruction(solanaPubkey, neonPubkey, depositPubkey, neonWalletAddress, serviceWallet) { + return createNeonDepositInstruction(solanaPubkey, neonPubkey, depositPubkey, neonWalletAddress, this.programId, this.tokenMint, serviceWallet); + } + neonTransferInstruction(solanaWallet, serviceWallet, rewardAmount) { + return createNeonTransferInstruction(this.tokenMint, solanaWallet, serviceWallet, rewardAmount); + } + getAuthorityPoolAddress() { + return authorityPoolAddress(this.programId); + } + createWithdrawEthTransactionData() { + return neonTransactionDataWeb3(this.web3, this.solanaWalletPubkey); + } + ethereumTransaction(amount, token) { + const from = this.neonWalletAddress; + const to = this.neonContractAddress; + const value = `0x${BigInt(this.web3.utils.toWei(amount.toString(), 'ether')).toString(16)}`; + const data = this.createWithdrawEthTransactionData(); + return { from, to, value, data }; + } + createWithdrawWNeonTransaction(amount, address) { + const contract = this.neonWrapper2Contract(address); + return contract.methods.withdraw(amount).encodeABI(); + } + wNeonTransaction(amount, token) { + const from = this.neonWalletAddress; + const to = token.address; + const value = `0x0`; + const data = this.createWithdrawWNeonTransaction(this.web3.utils.toWei(amount.toString(), 'ether'), to); + return { from, to, value, data }; + } + neonTransaction(amount, token) { + const from = this.neonWalletAddress; + const to = token.address; + const value = `0x${BigInt(this.web3.utils.toWei(amount.toString(), 'ether')).toString(16)}`; + const data = this.createWithdrawEthTransactionData(); + return { from, to, value, data }; + } +} diff --git a/dist/core/deprecated/index.d.ts b/dist/esm/core/deprecated/index.js similarity index 100% rename from dist/core/deprecated/index.d.ts rename to dist/esm/core/deprecated/index.js diff --git a/dist/core/index.d.ts b/dist/esm/core/index.js similarity index 100% rename from dist/core/index.d.ts rename to dist/esm/core/index.js diff --git a/dist/esm/core/mint-transfer.js b/dist/esm/core/mint-transfer.js new file mode 100644 index 00000000..c87ef491 --- /dev/null +++ b/dist/esm/core/mint-transfer.js @@ -0,0 +1,304 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, Transaction, TransactionInstruction } from '@solana/web3.js'; +import { ASSOCIATED_TOKEN_PROGRAM_ID, createApproveInstruction, createCloseAccountInstruction, createSyncNativeInstruction, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID } from '@solana/spl-token'; +import { Buffer } from 'buffer'; +import { numberTo64BitLittleEndian, toBytesInt32, toFullAmount } from '../utils'; +import { COMPUTE_BUDGET_ID, NEON_COMPUTE_UNITS, NEON_HEAP_FRAME, NEON_STATUS_DEVNET_SNAPSHOT } from '../data'; +import { authAccountAddress, collateralPoolAddress, erc20ForSPLContractWeb3, neonBalanceProgramAddress, neonWalletProgramAddress, solanaWalletSigner } from './utils'; +export function neonTransferMintWeb3Transaction(connection, web3, proxyApi, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, splToken, amount, chainId) { + return __awaiter(this, void 0, void 0, function* () { + const fullAmount = toFullAmount(amount, splToken.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), solanaWallet); + const climeData = climeTransactionDataWeb3(web3, associatedTokenAddress, neonWallet, fullAmount); + const walletSigner = solanaWalletSigner(web3, solanaWallet, neonWallet); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); + const { neonKeys, legacyAccounts } = yield createClaimInstruction(proxyApi, signedTransaction); + return neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, chainId); + }); +} +export function neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, emulateSigner, neonKeys, legacyAccounts, neonTransaction, splToken, amount, chainId) { + return __awaiter(this, void 0, void 0, function* () { + const computedBudgetProgram = new PublicKey(COMPUTE_BUDGET_ID); + const [delegatePDA] = authAccountAddress(emulateSigner.address, neonEvmProgram, splToken); + const [neonWalletBalanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const [emulateSignerBalanceAddress] = neonBalanceProgramAddress(emulateSigner.address, neonEvmProgram, chainId); + const neonWalletBalanceAccount = yield connection.getAccountInfo(neonWalletBalanceAddress); + const emulateSignerBalanceAccount = yield connection.getAccountInfo(emulateSignerBalanceAddress); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), solanaWallet); + const transaction = new Transaction({ feePayer: solanaWallet }); + transaction.add(createComputeBudgetHeapFrameInstruction(computedBudgetProgram, proxyStatus)); + transaction.add(createApproveDepositInstruction(solanaWallet, delegatePDA, associatedTokenAddress, amount)); + if (!neonWalletBalanceAccount) { + transaction.add(createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonWallet, chainId)); + } + if (!emulateSignerBalanceAccount) { + transaction.add(createAccountBalanceInstruction(solanaWallet, neonEvmProgram, emulateSigner.address, chainId)); + } + for (const account of legacyAccounts) { + const instruction = yield createAccountBalanceForLegacyAccountInstruction(connection, account, solanaWallet, neonEvmProgram, chainId); + if (instruction) { + transaction.add(instruction); + } + } + if (neonTransaction === null || neonTransaction === void 0 ? void 0 : neonTransaction.rawTransaction) { + transaction.add(createExecFromDataInstructionV2(solanaWallet, neonWallet, neonEvmProgram, neonTransaction.rawTransaction, neonKeys, proxyStatus, chainId)); + } + return transaction; + }); +} +export function createComputeBudgetUtilsInstruction(programId, proxyStatus) { + var _a; + const a = Buffer.from([0x00]); + const b = Buffer.from(toBytesInt32(parseInt((_a = proxyStatus.NEON_COMPUTE_UNITS) !== null && _a !== void 0 ? _a : NEON_COMPUTE_UNITS))); + const c = Buffer.from(toBytesInt32(0)); + const data = Buffer.concat([a, b, c]); + return new TransactionInstruction({ programId, data, keys: [] }); +} +export function createComputeBudgetHeapFrameInstruction(programId, proxyStatus) { + var _a; + const a = Buffer.from([0x01]); + const b = Buffer.from(toBytesInt32(parseInt((_a = proxyStatus.NEON_HEAP_FRAME) !== null && _a !== void 0 ? _a : NEON_HEAP_FRAME))); + const data = Buffer.concat([a, b]); + return new TransactionInstruction({ programId, data, keys: [] }); +} +export function createApproveDepositInstruction(solanaWallet, neonPDAWallet, associatedToken, amount) { + return createApproveInstruction(associatedToken, neonPDAWallet, solanaWallet, amount); +} +export function createAccountV3Instruction(solanaWallet, neonPDAWallet, neonEvmProgram, neonWallet) { + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: neonPDAWallet, isSigner: false, isWritable: true } + ]; + const a = Buffer.from([40 /* EvmInstruction.CreateAccountV03 */]); + const b = Buffer.from(neonWallet.slice(2), 'hex'); + const data = Buffer.concat([a, b]); + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function createAccountBalanceForLegacyAccountInstruction(connection, account, solanaWallet, neonEvmProgram, chainId) { + return __awaiter(this, void 0, void 0, function* () { + const accountAddress = new PublicKey(account.pubkey); + const accountInfo = yield connection.getAccountInfo(accountAddress); + if (accountInfo) { + const neonAddress = `0x${accountInfo === null || accountInfo === void 0 ? void 0 : accountInfo.data.slice(1, 21).toString('hex')}`; + return createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonAddress, chainId); + } + return null; + }); +} +export function createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonWallet, chainId) { + const [neonWalletAddress] = neonWalletProgramAddress(neonWallet, neonEvmProgram); + const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: balanceAddress, isSigner: false, isWritable: true }, + { pubkey: neonWalletAddress, isSigner: false, isWritable: true } + ]; + const a = Buffer.from([48 /* EvmInstruction.AccountCreateBalance */]); + const b = Buffer.from(neonWallet.slice(2), 'hex'); + const c = numberTo64BitLittleEndian(chainId); + const data = Buffer.concat([a, b, c]); + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function climeTransactionDataWeb3(web3, associatedToken, neonWallet, amount) { + const claimTo = erc20ForSPLContractWeb3(web3).methods.claimTo(associatedToken.toBuffer(), neonWallet, amount); + return claimTo.encodeABI(); +} +export function neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = { + data: climeData, + gas: `0x5F5E100`, + gasPrice: `0x0`, + from: neonWallet, + to: splToken.address // contract address + }; + return walletSigner.signTransaction(transaction); + }); +} +export function createClaimInstructionKeys(neonEmulate) { + const legacyAccounts = []; + const accountsMap = new Map(); + if (neonEmulate) { + const { accounts = [], solana_accounts = [] } = neonEmulate; + for (const account of accounts) { + const key = account['account']; + accountsMap.set(key, { pubkey: new PublicKey(key), isSigner: false, isWritable: true }); + if (account['contract']) { + const key = account['contract']; + accountsMap.set(key, { pubkey: new PublicKey(key), isSigner: false, isWritable: true }); + } + } + for (const account of solana_accounts) { + const { pubkey, is_legacy, is_writable } = account; + accountsMap.set(pubkey, { + pubkey: new PublicKey(pubkey), + isSigner: false, + isWritable: is_writable + }); + if (is_legacy) { + legacyAccounts.push(account); + } + } + } + return { neonKeys: Array.from(accountsMap.values()), legacyAccounts }; +} +export function createClaimInstruction(proxyApi, neonTransaction) { + return __awaiter(this, void 0, void 0, function* () { + if (neonTransaction.rawTransaction) { + const neonEmulate = yield proxyApi.neonEmulate([neonTransaction.rawTransaction.slice(2)]); + return createClaimInstructionKeys(neonEmulate); + } + return { neonKeys: [], legacyAccounts: [], neonTransaction }; + }); +} +export function createExecFromDataInstruction(solanaWallet, neonPDAWallet, neonEvmProgram, neonRawTransaction, neonKeys, proxyStatus) { + const count = Number(proxyStatus.NEON_POOL_COUNT); + const treasuryPoolIndex = Math.floor(Math.random() * count) % count; + const [treasuryPoolAddress] = collateralPoolAddress(neonEvmProgram, treasuryPoolIndex); + const a = Buffer.from([50 /* EvmInstruction.TransactionExecuteFromInstruction */]); + const b = Buffer.from(toBytesInt32(treasuryPoolIndex)); + const c = Buffer.from(neonRawTransaction.slice(2), 'hex'); + const data = Buffer.concat([a, b, c]); + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: treasuryPoolAddress, isSigner: false, isWritable: true }, + { pubkey: neonPDAWallet, isSigner: false, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: neonEvmProgram, isSigner: false, isWritable: false }, + ...neonKeys + ]; + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function createExecFromDataInstructionV2(solanaWallet, neonWallet, neonEvmProgram, neonRawTransaction, neonKeys, proxyStatus, chainId) { + var _a; + const count = Number((_a = proxyStatus.NEON_POOL_COUNT) !== null && _a !== void 0 ? _a : NEON_STATUS_DEVNET_SNAPSHOT.NEON_POOL_COUNT); + const treasuryPoolIndex = Math.floor(Math.random() * count) % count; + const [balanceAccount] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const [treasuryPoolAddress] = collateralPoolAddress(neonEvmProgram, treasuryPoolIndex); + const a = Buffer.from([50 /* EvmInstruction.TransactionExecuteFromInstruction */]); + const b = Buffer.from(toBytesInt32(treasuryPoolIndex)); + const c = Buffer.from(neonRawTransaction.slice(2), 'hex'); + const data = Buffer.concat([a, b, c]); + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: treasuryPoolAddress, isSigner: false, isWritable: true }, + { pubkey: balanceAccount, isSigner: false, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: true }, + ...neonKeys + ]; + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function createMintNeonTransactionWeb3(web3, neonWallet, associatedToken, splToken, amount, gasLimit = 5e4) { + return __awaiter(this, void 0, void 0, function* () { + const data = mintNeonTransactionDataWeb3(web3, associatedToken, splToken, amount); + const transaction = createMintNeonTransaction(neonWallet, splToken, data); + transaction.gasPrice = yield web3.eth.getGasPrice(); + transaction.gas = yield web3.eth.estimateGas(transaction); + transaction.nonce = (yield web3.eth.getTransactionCount(neonWallet)); + // @ts-ignore + transaction['gasLimit'] = transaction.gas > gasLimit ? transaction.gas + 1e4 : gasLimit; + return transaction; + }); +} +export function mintNeonTransactionDataWeb3(web3, associatedToken, splToken, amount) { + const fullAmount = toFullAmount(amount, splToken.decimals); + return erc20ForSPLContractWeb3(web3).methods.transferSolana(associatedToken.toBuffer(), fullAmount).encodeABI(); +} +export function createMintNeonTransaction(neonWallet, splToken, data) { + return { data, from: neonWallet, to: splToken.address, value: `0x0` }; +} +export function createMintSolanaTransaction(solanaWallet, tokenMint, associatedToken, proxyStatus) { + const computedBudgetProgram = new PublicKey(COMPUTE_BUDGET_ID); + const transaction = new Transaction({ feePayer: solanaWallet }); + // transaction.add(createComputeBudgetUtilsInstruction(computedBudgetProgram, proxyStatus)); + transaction.add(createComputeBudgetHeapFrameInstruction(computedBudgetProgram, proxyStatus)); + transaction.add(createAssociatedTokenAccountInstruction(tokenMint, associatedToken, solanaWallet, solanaWallet)); + return transaction; +} +// #region Neon -> Solana +export function createAssociatedTokenAccountInstruction(tokenMint, associatedAccount, owner, payer, associatedProgramId = ASSOCIATED_TOKEN_PROGRAM_ID, programId = TOKEN_PROGRAM_ID) { + const data = Buffer.from([0x01]); + const keys = [ + { pubkey: payer, isSigner: true, isWritable: true }, + { pubkey: associatedAccount, isSigner: false, isWritable: true }, + { pubkey: owner, isSigner: false, isWritable: false }, + { pubkey: tokenMint, isSigner: false, isWritable: false }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: programId, isSigner: false, isWritable: false }, + { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false } + ]; + return new TransactionInstruction({ programId: associatedProgramId, keys, data }); +} +export function createWrapSOLTransaction(connection, solanaWallet, amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const tokenMint = new PublicKey(splToken.address_spl); + const lamports = toFullAmount(amount, splToken.decimals); + const associatedToken = getAssociatedTokenAddressSync(tokenMint, solanaWallet); + const wSOLAccount = yield connection.getAccountInfo(associatedToken); + const transaction = new Transaction({ feePayer: solanaWallet }); + const instructions = []; + if (!wSOLAccount) { + instructions.push(createAssociatedTokenAccountInstruction(tokenMint, associatedToken, solanaWallet, solanaWallet)); + } + instructions.push(SystemProgram.transfer({ + fromPubkey: solanaWallet, + toPubkey: associatedToken, + lamports + })); + instructions.push(createSyncNativeInstruction(associatedToken, TOKEN_PROGRAM_ID)); + transaction.add(...instructions); + return transaction; + }); +} +export function createUnwrapSOLTransaction(connection, solanaWallet, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const tokenMint = new PublicKey(splToken.address_spl); + const associatedToken = getAssociatedTokenAddressSync(tokenMint, solanaWallet); + const wSOLAccount = yield connection.getAccountInfo(associatedToken); + if (!wSOLAccount) { + throw new Error(`Error: ${associatedToken.toBase58()} haven't created account...`); + } + const transaction = new Transaction({ feePayer: solanaWallet }); + const instructions = []; + instructions.push(createCloseAccountInstruction(associatedToken, solanaWallet, solanaWallet)); + transaction.add(...instructions); + return transaction; + }); +} +export function createWrapAndTransferSOLTransactionWeb3(connection, web3, proxyApi, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, splToken, amount, chainId = 111) { + return __awaiter(this, void 0, void 0, function* () { + const instructions = []; + const transaction = new Transaction({ feePayer: solanaWallet }); + const tokenMint = new PublicKey(splToken.address_spl); + const fullAmount = toFullAmount(amount, splToken.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(tokenMint, solanaWallet); + const wSOLAccount = yield connection.getAccountInfo(associatedTokenAddress); + const climeData = climeTransactionDataWeb3(web3, associatedTokenAddress, neonWallet, fullAmount); + const walletSigner = solanaWalletSigner(web3, solanaWallet, neonWallet); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); + const { neonKeys, legacyAccounts } = yield createClaimInstruction(proxyApi, signedTransaction); + const mintTransaction = yield neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, chainId); + if (!wSOLAccount) { + instructions.push(createAssociatedTokenAccountInstruction(tokenMint, associatedTokenAddress, solanaWallet, solanaWallet)); + } + instructions.push(SystemProgram.transfer({ + fromPubkey: solanaWallet, + toPubkey: associatedTokenAddress, + lamports: fullAmount + })); + instructions.push(createSyncNativeInstruction(associatedTokenAddress, TOKEN_PROGRAM_ID)); + transaction.add(...instructions); + transaction.add(...mintTransaction.instructions); + return transaction; + }); +} diff --git a/dist/esm/core/multy-transfer.js b/dist/esm/core/multy-transfer.js new file mode 100644 index 00000000..94992e37 --- /dev/null +++ b/dist/esm/core/multy-transfer.js @@ -0,0 +1,26 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { PublicKey } from '@solana/web3.js'; +import { createApproveInstruction, getAssociatedTokenAddressSync } from '@solana/spl-token'; +import { neonBalanceProgramAddress } from './utils'; +import { toFullAmount } from '../utils'; +import { createNeonDepositToBalanceInstruction } from './neon-transfer'; +import { createWrapSOLTransaction } from './mint-transfer'; +export function solanaSOLTransferTransaction(connection, solanaWallet, neonWallet, neonEvmProgram, neonTokenMint, token, amount, chainId = 111) { + return __awaiter(this, void 0, void 0, function* () { + const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const fullAmount = toFullAmount(amount, token.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(token.address_spl), solanaWallet); + const transaction = yield createWrapSOLTransaction(connection, solanaWallet, amount, token); + transaction.add(createApproveInstruction(associatedTokenAddress, balanceAddress, solanaWallet, fullAmount)); + transaction.add(createNeonDepositToBalanceInstruction(chainId, solanaWallet, associatedTokenAddress, neonWallet, neonEvmProgram, neonTokenMint)); + return transaction; + }); +} diff --git a/dist/core/neon-transfer.js b/dist/esm/core/neon-transfer.js similarity index 59% rename from dist/core/neon-transfer.js rename to dist/esm/core/neon-transfer.js index ddaac08d..96dbf500 100644 --- a/dist/core/neon-transfer.js +++ b/dist/esm/core/neon-transfer.js @@ -1,21 +1,32 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; import { PublicKey, SystemProgram, Transaction, TransactionInstruction } from '@solana/web3.js'; import { createApproveInstruction, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, TokenInstruction, transferInstructionData } from '@solana/spl-token'; import { toWei } from 'web3-utils'; import { numberTo64BitLittleEndian, toBigInt, toFullAmount } from '../utils'; import { NEON_TOKEN_DECIMALS } from '../data'; -import { authorityPoolAddress, neonBalanceProgramAddress, neonWalletProgramAddress, neonWrapper2Contract, neonWrapperContract } from './utils'; -export async function solanaNEONTransferTransaction(solanaWallet, neonWallet, neonEvmProgram, neonTokenMint, token, amount, chainId = 111, serviceWallet, rewardAmount) { - const neonToken = { ...token, decimals: Number(NEON_TOKEN_DECIMALS) }; - const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); - const fullAmount = toFullAmount(amount, neonToken.decimals); - const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(neonToken.address_spl), solanaWallet); - const transaction = new Transaction({ feePayer: solanaWallet }); - transaction.add(createApproveInstruction(associatedTokenAddress, balanceAddress, solanaWallet, fullAmount)); - transaction.add(createNeonDepositToBalanceInstruction(chainId, solanaWallet, associatedTokenAddress, neonWallet, neonEvmProgram, neonTokenMint, serviceWallet)); - if (serviceWallet && rewardAmount) { - transaction.add(createNeonTransferInstruction(neonTokenMint, solanaWallet, serviceWallet, rewardAmount)); - } - return transaction; +import { authorityPoolAddress, neonBalanceProgramAddress, neonWalletProgramAddress, neonWrapper2ContractWeb3, neonWrapperContractWeb3 } from './utils'; +export function solanaNEONTransferTransaction(solanaWallet, neonWallet, neonEvmProgram, neonTokenMint, token, amount, chainId = 111, serviceWallet, rewardAmount) { + return __awaiter(this, void 0, void 0, function* () { + const neonToken = Object.assign(Object.assign({}, token), { decimals: Number(NEON_TOKEN_DECIMALS) }); + const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const fullAmount = toFullAmount(amount, neonToken.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(neonToken.address_spl), solanaWallet); + const transaction = new Transaction({ feePayer: solanaWallet }); + transaction.add(createApproveInstruction(associatedTokenAddress, balanceAddress, solanaWallet, fullAmount)); + transaction.add(createNeonDepositToBalanceInstruction(chainId, solanaWallet, associatedTokenAddress, neonWallet, neonEvmProgram, neonTokenMint, serviceWallet)); + if (serviceWallet && rewardAmount) { + transaction.add(createNeonTransferInstruction(neonTokenMint, solanaWallet, serviceWallet, rewardAmount)); + } + return transaction; + }); } export function createNeonDepositToBalanceInstruction(chainId, solanaWallet, tokenAddress, neonWallet, neonEvmProgram, tokenMint, serviceWallet) { const [depositWallet] = authorityPoolAddress(neonEvmProgram); @@ -70,12 +81,12 @@ export function createNeonTransferInstruction(neonTokenMint, solanaWallet, servi }, data); return new TransactionInstruction({ programId: TOKEN_PROGRAM_ID, keys, data }); } -export function neonTransactionData(web3, solanaWallet) { - return neonWrapperContract(web3).methods.withdraw(solanaWallet.toBuffer()).encodeABI(); +export function neonTransactionDataWeb3(web3, solanaWallet) { + return neonWrapperContractWeb3(web3).methods.withdraw(solanaWallet.toBuffer()).encodeABI(); } -export function wrappedNeonTransactionData(web3, token, amount) { +export function wrappedNeonTransactionDataWeb3(web3, token, amount) { const value = toWei(amount.toString(), 'ether'); - const contract = neonWrapper2Contract(web3, token.address); + const contract = neonWrapper2ContractWeb3(web3, token.address); return contract.methods.withdraw(value).encodeABI(); } export function wrappedNeonTransaction(from, to, data) { @@ -86,13 +97,14 @@ export function neonNeonTransaction(from, to, amount, data) { const value = `0x${BigInt(toWei(amount.toString(), 'ether')).toString(16)}`; return { from, to, value, data }; } -export async function neonNeonWeb3Transaction(web3, from, to, solanaWallet, amount, gasLimit = 5e4) { - const data = neonTransactionData(web3, solanaWallet); - const transaction = neonNeonTransaction(from, to, amount, data); - transaction.gasPrice = await web3.eth.getGasPrice(); - transaction.gas = await web3.eth.estimateGas(transaction); - // @ts-ignore - transaction['gasLimit'] = transaction.gas > gasLimit ? transaction.gas + 1e4 : gasLimit; - return transaction; +export function neonNeonTransactionWeb3(web3, from, to, solanaWallet, amount, gasLimit = 5e4) { + return __awaiter(this, void 0, void 0, function* () { + const data = neonTransactionDataWeb3(web3, solanaWallet); + const transaction = neonNeonTransaction(from, to, amount, data); + transaction.gasPrice = yield web3.eth.getGasPrice(); + transaction.gas = yield web3.eth.estimateGas(transaction); + // @ts-ignore + transaction['gasLimit'] = transaction.gas > gasLimit ? transaction.gas + 1e4 : gasLimit; + return transaction; + }); } -//# sourceMappingURL=neon-transfer.js.map \ No newline at end of file diff --git a/dist/core/utils/accounts.js b/dist/esm/core/utils/accounts.js similarity index 88% rename from dist/core/utils/accounts.js rename to dist/esm/core/utils/accounts.js index b187904c..48d0c712 100644 --- a/dist/core/utils/accounts.js +++ b/dist/esm/core/utils/accounts.js @@ -3,4 +3,3 @@ export function solanaWalletSigner(web3, solanaWallet, neonWallet) { const emulateSignerPrivateKey = `0x${SHA256(solanaWallet.toBase58() + neonWallet).toString()}`; return web3.eth.accounts.privateKeyToAccount(emulateSignerPrivateKey); } -//# sourceMappingURL=accounts.js.map \ No newline at end of file diff --git a/dist/core/utils/addresses.js b/dist/esm/core/utils/addresses.js similarity index 98% rename from dist/core/utils/addresses.js rename to dist/esm/core/utils/addresses.js index 90bf458f..49250ea9 100644 --- a/dist/core/utils/addresses.js +++ b/dist/esm/core/utils/addresses.js @@ -35,4 +35,3 @@ export function collateralPoolAddress(neonWalletPDA, collateralPoolIndex) { export function authorityPoolAddress(programId) { return PublicKey.findProgramAddressSync([new Uint8Array(Buffer.from('Deposit', 'utf-8'))], programId); } -//# sourceMappingURL=addresses.js.map \ No newline at end of file diff --git a/dist/core/utils/contracts.js b/dist/esm/core/utils/contracts.js similarity index 56% rename from dist/core/utils/contracts.js rename to dist/esm/core/utils/contracts.js index 443e274e..ef9aeeff 100644 --- a/dist/core/utils/contracts.js +++ b/dist/esm/core/utils/contracts.js @@ -1,11 +1,10 @@ import { erc20Abi, neonWrapper2Abi, neonWrapperAbi } from '../../data'; -export function erc20ForSPLContract(web3) { +export function erc20ForSPLContractWeb3(web3) { return new web3.eth.Contract(erc20Abi); } -export function neonWrapperContract(web3) { +export function neonWrapperContractWeb3(web3) { return new web3.eth.Contract(neonWrapperAbi); } -export function neonWrapper2Contract(web3, address) { +export function neonWrapper2ContractWeb3(web3, address) { return new web3.eth.Contract(neonWrapper2Abi, address); } -//# sourceMappingURL=contracts.js.map \ No newline at end of file diff --git a/dist/core/utils/index.d.ts b/dist/esm/core/utils/index.js similarity index 100% rename from dist/core/utils/index.d.ts rename to dist/esm/core/utils/index.js diff --git a/dist/data/abi/erc20.js b/dist/esm/data/abi/erc20.js similarity index 99% rename from dist/data/abi/erc20.js rename to dist/esm/data/abi/erc20.js index e6c4c9a8..7b2bb9da 100644 --- a/dist/data/abi/erc20.js +++ b/dist/esm/data/abi/erc20.js @@ -451,4 +451,3 @@ export const erc20Abi = [ } ]; export default erc20Abi; -//# sourceMappingURL=erc20.js.map \ No newline at end of file diff --git a/dist/data/abi/index.d.ts b/dist/esm/data/abi/index.js similarity index 100% rename from dist/data/abi/index.d.ts rename to dist/esm/data/abi/index.js diff --git a/dist/data/abi/neonWrapper.js b/dist/esm/data/abi/neonWrapper.js similarity index 92% rename from dist/data/abi/neonWrapper.js rename to dist/esm/data/abi/neonWrapper.js index 0c1ed2fb..1fee5a52 100644 --- a/dist/data/abi/neonWrapper.js +++ b/dist/esm/data/abi/neonWrapper.js @@ -20,4 +20,3 @@ export const neonWrapperAbi = [ } ]; export default neonWrapperAbi; -//# sourceMappingURL=neonWrapper.js.map \ No newline at end of file diff --git a/dist/data/abi/neonWrapper2.js b/dist/esm/data/abi/neonWrapper2.js similarity index 99% rename from dist/data/abi/neonWrapper2.js rename to dist/esm/data/abi/neonWrapper2.js index 19670446..2d1edf94 100644 --- a/dist/data/abi/neonWrapper2.js +++ b/dist/esm/data/abi/neonWrapper2.js @@ -127,4 +127,3 @@ export const neonWrapper2Abi = [{ 'type': 'event' }]; export default neonWrapper2Abi; -//# sourceMappingURL=neonWrapper2.js.map \ No newline at end of file diff --git a/dist/data/constants.js b/dist/esm/data/constants.js similarity index 97% rename from dist/data/constants.js rename to dist/esm/data/constants.js index bb5a5085..d1c7a80c 100644 --- a/dist/data/constants.js +++ b/dist/esm/data/constants.js @@ -14,4 +14,3 @@ export const NEON_TOKEN_MINT_DEVNET = '89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2k export const SOL_TOKEN_MINT_DEVNET = '89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g'; export const NEON_TOKEN_MINT_MAINNET = 'NeonTjSjsuo3rexg9o6vHuMXw62f9V7zvmu8M8Zut44'; export const SOL_TOKEN_MINT_MAINNET = 'NeonTjSjsuo3rexg9o6vHuMXw62f9V7zvmu8M8Zut44'; -//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/dist/data/index.d.ts b/dist/esm/data/index.js similarity index 100% rename from dist/data/index.d.ts rename to dist/esm/data/index.js diff --git a/dist/data/proxy.js b/dist/esm/data/proxy.js similarity index 98% rename from dist/data/proxy.js rename to dist/esm/data/proxy.js index 8a77361f..712319fb 100644 --- a/dist/data/proxy.js +++ b/dist/esm/data/proxy.js @@ -52,4 +52,3 @@ export const TOKEN_LIST_DEVNET_SNAPSHOT = [{ const proxyStatusSnapshot = new Map(); proxyStatusSnapshot.set('mainnet', NEON_STATUS_MAINNET_SNAPSHOT); proxyStatusSnapshot.set('devnet', NEON_STATUS_DEVNET_SNAPSHOT); -//# sourceMappingURL=proxy.js.map \ No newline at end of file diff --git a/dist/index.d.ts b/dist/esm/index.js similarity index 100% rename from dist/index.d.ts rename to dist/esm/index.js diff --git a/dist/esm/models/api.js b/dist/esm/models/api.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/esm/models/api.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/esm/models/events.js b/dist/esm/models/events.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/esm/models/events.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/models/index.d.ts b/dist/esm/models/index.js similarity index 100% rename from dist/models/index.d.ts rename to dist/esm/models/index.js diff --git a/dist/esm/models/instruction.js b/dist/esm/models/instruction.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/esm/models/instruction.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/esm/models/token.js b/dist/esm/models/token.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/esm/models/token.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/esm/package.json b/dist/esm/package.json new file mode 100644 index 00000000..1632c2c4 --- /dev/null +++ b/dist/esm/package.json @@ -0,0 +1 @@ +{"type": "module"} \ No newline at end of file diff --git a/dist/react/index.d.ts b/dist/esm/react/index.js similarity index 100% rename from dist/react/index.d.ts rename to dist/esm/react/index.js diff --git a/dist/react/neon-transfer.js b/dist/esm/react/neon-transfer.js similarity index 98% rename from dist/react/neon-transfer.js rename to dist/esm/react/neon-transfer.js index 6ca486fb..15fdf890 100644 --- a/dist/react/neon-transfer.js +++ b/dist/esm/react/neon-transfer.js @@ -44,4 +44,3 @@ export function useNeonTransfer(events, connection, web3, publicKey, neonWalletA }; return { deposit, withdraw, getEthereumTransactionParams, proxyStatus }; } -//# sourceMappingURL=neon-transfer.js.map \ No newline at end of file diff --git a/dist/react/proxy-status.js b/dist/esm/react/proxy-status.js similarity index 95% rename from dist/react/proxy-status.js rename to dist/esm/react/proxy-status.js index fc4b2527..9fb77281 100644 --- a/dist/react/proxy-status.js +++ b/dist/esm/react/proxy-status.js @@ -26,4 +26,3 @@ export function useProxyInfo(api) { }, [api]); return status; } -//# sourceMappingURL=proxy-status.js.map \ No newline at end of file diff --git a/dist/utils/address.js b/dist/esm/utils/address.js similarity index 98% rename from dist/utils/address.js rename to dist/esm/utils/address.js index 0586f385..c5f02654 100644 --- a/dist/utils/address.js +++ b/dist/esm/utils/address.js @@ -37,4 +37,3 @@ export function toU256BE(bigIntNumber) { } return new Uint8Array(buffer); } -//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/dist/utils/hex.js b/dist/esm/utils/hex.js similarity index 88% rename from dist/utils/hex.js rename to dist/esm/utils/hex.js index 2ca05a11..ac8cd93d 100644 --- a/dist/utils/hex.js +++ b/dist/esm/utils/hex.js @@ -5,4 +5,3 @@ export function isValidHex(hex) { } return isHexStrict; } -//# sourceMappingURL=hex.js.map \ No newline at end of file diff --git a/dist/utils/index.d.ts b/dist/esm/utils/index.js similarity index 100% rename from dist/utils/index.d.ts rename to dist/esm/utils/index.js diff --git a/dist/utils/transaction.js b/dist/esm/utils/transaction.js similarity index 93% rename from dist/utils/transaction.js rename to dist/esm/utils/transaction.js index da4c0cde..a8b32689 100644 --- a/dist/utils/transaction.js +++ b/dist/esm/utils/transaction.js @@ -11,4 +11,3 @@ ${JSON.stringify(data)} ------------------------------`; }).join('\n\n')); } -//# sourceMappingURL=transaction.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index b6728ae4..00000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/models/api.js b/dist/models/api.js deleted file mode 100644 index b3508872..00000000 --- a/dist/models/api.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/dist/models/api.js.map b/dist/models/api.js.map deleted file mode 100644 index 6b2cbc8e..00000000 --- a/dist/models/api.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/models/api.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/models/events.js b/dist/models/events.js deleted file mode 100644 index 4b09bff3..00000000 --- a/dist/models/events.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/dist/models/events.js.map b/dist/models/events.js.map deleted file mode 100644 index d82e63ba..00000000 --- a/dist/models/events.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/models/events.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/models/index.js.map b/dist/models/index.js.map deleted file mode 100644 index 46499b70..00000000 --- a/dist/models/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/models/instruction.js b/dist/models/instruction.js deleted file mode 100644 index 80132eb4..00000000 --- a/dist/models/instruction.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=instruction.js.map \ No newline at end of file diff --git a/dist/models/instruction.js.map b/dist/models/instruction.js.map deleted file mode 100644 index a344eecd..00000000 --- a/dist/models/instruction.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"instruction.js","sourceRoot":"","sources":["../../src/models/instruction.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/models/token.js b/dist/models/token.js deleted file mode 100644 index b961eb96..00000000 --- a/dist/models/token.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=token.js.map \ No newline at end of file diff --git a/dist/models/token.js.map b/dist/models/token.js.map deleted file mode 100644 index b9a3dcf4..00000000 --- a/dist/models/token.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/models/token.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/react/index.js.map b/dist/react/index.js.map deleted file mode 100644 index 49d57118..00000000 --- a/dist/react/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"} \ No newline at end of file diff --git a/dist/react/neon-transfer.js.map b/dist/react/neon-transfer.js.map deleted file mode 100644 index 24a908fa..00000000 --- a/dist/react/neon-transfer.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"neon-transfer.js","sourceRoot":"","sources":["../../src/react/neon-transfer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IACjF,YAAY,EAAE,+BAA+B;IAC7C,eAAe,EAAE,4BAA4B;CAC9C,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC;IAC1C,YAAY,EAAE,IAAI,CAAC,YAAY;IAC/B,eAAe,EAAE,IAAI,CAAC,eAAe;CACtC,CAAC,CAAC;AAEH;;;IAGI;AACJ,MAAM,UAAU,eAAe,CAAC,MAAyB,EAAE,UAAsB,EAAE,IAAU,EAAE,SAAoB,EAAE,iBAAyB,EAAE,mBAAmB,GAAG,6BAA6B;IACjM,MAAM,WAAW,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAsB;QACjC,UAAU,EAAE,UAAU;QACtB,mBAAmB,EAAE,SAAS;QAC9B,iBAAiB;QACjB,mBAAmB;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git a/dist/react/proxy-status.js.map b/dist/react/proxy-status.js.map deleted file mode 100644 index db81b4d3..00000000 --- a/dist/react/proxy-status.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"proxy-status.js","sourceRoot":"","sources":["../../src/react/proxy-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5C,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AAEzC,MAAM,UAAU,YAAY,CAAC,GAAoB;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAoB,EAAuB,CAAC,CAAC;IAEjF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,cAAc,IAAI,MAAM,EAAE;YAC5B,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YAC/C,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3B,IAAI;oBACF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAC/B,SAAS,CAAC,KAAK,CAAC,CAAC;iBAClB;gBAAC,OAAO,CAAC,EAAE;oBACV,EAAE;iBACH;aACF;SACF;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAC5B,SAAS,CAAC,MAAM,CAAC,CAAC;YAClB,IAAI,cAAc,IAAI,MAAM,EAAE;gBAC5B,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/dist/types/api/index.d.ts b/dist/types/api/index.d.ts new file mode 100644 index 00000000..468606aa --- /dev/null +++ b/dist/types/api/index.d.ts @@ -0,0 +1 @@ +export * from './neon-proxy-rpc'; diff --git a/dist/api/index.js b/dist/types/api/index.js similarity index 50% rename from dist/api/index.js rename to dist/types/api/index.js index 262d7fd5..468606aa 100644 --- a/dist/api/index.js +++ b/dist/types/api/index.js @@ -1,2 +1 @@ export * from './neon-proxy-rpc'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/api/neon-proxy-rpc.d.ts b/dist/types/api/neon-proxy-rpc.d.ts similarity index 100% rename from dist/api/neon-proxy-rpc.d.ts rename to dist/types/api/neon-proxy-rpc.d.ts diff --git a/dist/types/api/neon-proxy-rpc.js b/dist/types/api/neon-proxy-rpc.js new file mode 100644 index 00000000..1d9eaa7d --- /dev/null +++ b/dist/types/api/neon-proxy-rpc.js @@ -0,0 +1,61 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +export class NeonProxyRpcApi { + constructor(params) { + var _a, _b; + this.neonProxyRpcApi = ''; + this.solanaRpcApi = ''; + this.neonProxyRpcApi = (_a = params.neonProxyRpcApi) !== null && _a !== void 0 ? _a : ''; + this.solanaRpcApi = (_b = params.solanaRpcApi) !== null && _b !== void 0 ? _b : ''; + } + rpc(url, method, params = []) { + return __awaiter(this, void 0, void 0, function* () { + const id = Date.now(); + const body = { id, jsonrpc: '2.0', method, params }; + console.log('POST', url, JSON.stringify(body)); + const response = yield fetch(url, { + method: 'POST', + mode: 'cors', + body: JSON.stringify(body) + }); + return yield response.json(); + }); + } + proxy(method, params = []) { + return __awaiter(this, void 0, void 0, function* () { + return this.rpc(this.neonProxyRpcApi, method, params); + }); + } + solana(method, params = []) { + return __awaiter(this, void 0, void 0, function* () { + return this.rpc(this.solanaRpcApi, method, params); + }); + } + neonEmulate(params = []) { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_emulate', params).then(d => d.result); + }); + } + evmParams() { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_getEvmParams', []).then(d => d.result); + }); + } + gasTokenList() { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_getGasTokenList', []).then(d => d.result); + }); + } + nativeTokenList() { + return __awaiter(this, void 0, void 0, function* () { + return this.proxy('neon_getNativeTokenList', []).then(d => d.result); + }); + } +} diff --git a/dist/core/deprecated/InstructionService.d.ts b/dist/types/core/deprecated/InstructionService.d.ts similarity index 100% rename from dist/core/deprecated/InstructionService.d.ts rename to dist/types/core/deprecated/InstructionService.d.ts diff --git a/dist/types/core/deprecated/InstructionService.js b/dist/types/core/deprecated/InstructionService.js new file mode 100644 index 00000000..16ff98a4 --- /dev/null +++ b/dist/types/core/deprecated/InstructionService.js @@ -0,0 +1,108 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { PublicKey } from '@solana/web3.js'; +import { createApproveInstruction, getAssociatedTokenAddressSync } from '@solana/spl-token'; +import { toFullAmount } from '../../utils'; +import { erc20Abi, NEON_TOKEN_MINT_DEVNET, neonWrapper2Abi, neonWrapperAbi } from '../../data'; +import { authAccountAddress, neonWalletProgramAddress, solanaWalletSigner } from '../utils'; +import { createAccountV3Instruction } from '../mint-transfer'; +const noop = new Function(); +/** + * @deprecated this code was deprecated and will remove in next releases. + * Please use other methods from mint-transfer.ts and neon-transfer.ts files + * For more examples see `examples` folder + */ +export class InstructionService { + get programId() { + return new PublicKey(this.proxyStatus.NEON_EVM_ID); + } + get tokenMint() { + var _a; + return new PublicKey((_a = this.proxyStatus.NEON_TOKEN_MINT) !== null && _a !== void 0 ? _a : NEON_TOKEN_MINT_DEVNET); + } + constructor(options) { + var _a; + this.emitFunction = (functionName, ...args) => { + if (typeof functionName === 'function') { + functionName(...args); + } + }; + this.web3 = options.web3; + this.proxyApi = options.proxyApi; + this.proxyStatus = options.proxyStatus; + this.solanaWalletAddress = options.solanaWalletAddress || ''; + this.neonWalletAddress = options.neonWalletAddress || ''; + this.neonContractAddress = options.neonContractAddress || ''; + this.connection = options.connection; + this.solanaOptions = (_a = options.solanaOptions) !== null && _a !== void 0 ? _a : { skipPreflight: false }; + this.events = { + onBeforeCreateInstruction: options.onBeforeCreateInstruction || noop, + onCreateNeonAccountInstruction: options.onCreateNeonAccountInstruction || noop, + onBeforeSignTransaction: options.onBeforeSignTransaction || noop, + onBeforeNeonSign: options.onBeforeNeonSign || noop, + onSuccessSign: options.onSuccessSign || noop, + onErrorSign: options.onErrorSign || noop + }; + } + get erc20ForSPLContract() { + return new this.web3.eth.Contract(erc20Abi); + } + get neonWrapperContract() { + return new this.web3.eth.Contract(neonWrapperAbi); + } + neonWrapper2Contract(address) { + return new this.web3.eth.Contract(neonWrapper2Abi, address); + } + get solana() { + if ('solana' in window) { + return window['solana']; + } + return {}; + } + get solanaWalletPubkey() { + return new PublicKey(this.solanaWalletAddress); + } + get solanaWalletSigner() { + return solanaWalletSigner(this.web3, this.solanaWalletPubkey, this.neonWalletAddress); + } + neonAccountAddress(neonWallet) { + return neonWalletProgramAddress(neonWallet, this.programId); + } + authAccountAddress(neonWallet, token) { + return authAccountAddress(neonWallet, this.programId, token); + } + getNeonAccount(neonAssociatedKey) { + return __awaiter(this, void 0, void 0, function* () { + return this.connection.getAccountInfo(neonAssociatedKey); + }); + } + createAccountV3Instruction(solanaWallet, neonWalletPDA, neonWallet) { + return createAccountV3Instruction(solanaWallet, neonWalletPDA, this.programId, neonWallet); + } + getAssociatedTokenAddress(mintPubkey, walletPubkey) { + return getAssociatedTokenAddressSync(mintPubkey, walletPubkey); + } + approveDepositInstruction(walletPubkey, neonPDAPubkey, associatedTokenPubkey, amount) { + return createApproveInstruction(associatedTokenPubkey, neonPDAPubkey, walletPubkey, amount); + } + createApproveSolanaData(solanaWallet, splToken, amount) { + const fullAmount = toFullAmount(amount, splToken.decimals); + return this.erc20ForSPLContract.methods.approveSolana(solanaWallet.toBuffer(), fullAmount).encodeABI(); + } + ethereumTransaction(amount, token) { + const solanaWallet = this.solanaWalletPubkey; + return { + to: token.address, + from: this.neonWalletAddress, + value: '0x00', + data: this.createApproveSolanaData(solanaWallet, token, amount) + }; + } +} diff --git a/dist/core/deprecated/MintPortal.d.ts b/dist/types/core/deprecated/MintPortal.d.ts similarity index 100% rename from dist/core/deprecated/MintPortal.d.ts rename to dist/types/core/deprecated/MintPortal.d.ts diff --git a/dist/types/core/deprecated/MintPortal.js b/dist/types/core/deprecated/MintPortal.js new file mode 100644 index 00000000..9fd0f931 --- /dev/null +++ b/dist/types/core/deprecated/MintPortal.js @@ -0,0 +1,126 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { createAssociatedTokenAccountInstruction, getAssociatedTokenAddressSync } from '@solana/spl-token'; +import { PublicKey } from '@solana/web3.js'; +import { toFullAmount } from '../../utils'; +import { climeTransactionDataWeb3, createClaimInstruction, createComputeBudgetHeapFrameInstruction, createComputeBudgetUtilsInstruction, createExecFromDataInstruction, createMintNeonTransactionWeb3, createMintSolanaTransaction, createUnwrapSOLTransaction, createWrapSOLTransaction, neonClaimTransactionFromSigner, neonTransferMintTransaction } from '../mint-transfer'; +import { collateralPoolAddress, solanaWalletSigner } from '../utils'; +import { InstructionService } from './InstructionService'; +/** + * @deprecated this code was deprecated and will remove in next releases. + * Please use other methods in mint-transfer.ts file + * For more examples see `examples` folder + */ +export class MintPortal extends InstructionService { + // Solana -> Neon + createNeonTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + this.emitFunction(events.onBeforeCreateInstruction); + const transaction = yield this.neonTransferTransaction(amount, splToken); + this.emitFunction(events.onBeforeSignTransaction); + try { + const signedTransaction = yield this.solana.signTransaction(transaction); + const signature = yield this.connection.sendRawTransaction(signedTransaction.serialize(), this.solanaOptions); + this.emitFunction(events.onSuccessSign, signature); + } + catch (e) { + this.emitFunction(events.onErrorSign, e); + } + }); + } + // Neon -> Solana + createSolanaTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + const mintPubkey = new PublicKey(splToken.address_spl); + const walletPubkey = this.solanaWalletPubkey; + const associatedTokenPubkey = getAssociatedTokenAddressSync(mintPubkey, walletPubkey); + const solanaTransaction = yield this.solanaTransferTransaction(walletPubkey, mintPubkey, associatedTokenPubkey); + const neonTransaction = yield this.createNeonTransaction(this.neonWalletAddress, associatedTokenPubkey, splToken, amount); + neonTransaction.nonce = yield this.web3.eth.getTransactionCount(this.neonWalletAddress); + this.emitFunction(events.onBeforeSignTransaction); + try { + const signedSolanaTransaction = yield this.solana.signTransaction(solanaTransaction); + const signature = yield this.connection.sendRawTransaction(signedSolanaTransaction.serialize(), this.solanaOptions); + const { transactionHash } = yield this.web3.eth.sendTransaction(neonTransaction); + this.emitFunction(events.onSuccessSign, signature, transactionHash); + } + catch (error) { + this.emitFunction(events.onErrorSign, error); + } + }); + } + neonTransferTransaction(amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const fullAmount = toFullAmount(amount, splToken.decimals); + const walletSigner = yield solanaWalletSigner(this.web3, this.solanaWalletPubkey, this.neonWalletAddress); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), this.solanaWalletPubkey); + const climeData = climeTransactionDataWeb3(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, this.neonWalletAddress, splToken); + const { neonKeys, legacyAccounts } = yield createClaimInstruction(this.proxyApi, signedTransaction); + const transaction = yield neonTransferMintTransaction(this.connection, this.proxyStatus, this.programId, this.solanaWalletPubkey, this.neonWalletAddress, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, 111); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } + computeBudgetUtilsInstruction(programId) { + return createComputeBudgetUtilsInstruction(programId, this.proxyStatus); + } + computeBudgetHeapFrameInstruction(programId) { + return createComputeBudgetHeapFrameInstruction(programId, this.proxyStatus); + } + createClaimInstruction(owner, from, to, splToken, emulateSigner, amount) { + return __awaiter(this, void 0, void 0, function* () { + const nonce = yield this.web3.eth.getTransactionCount(emulateSigner.address); + const fullAmount = toFullAmount(amount, splToken.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), this.solanaWalletAddress); + const climeData = climeTransactionDataWeb3(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); + const walletSigner = yield solanaWalletSigner(this.web3, this.solanaWalletAddress, this.neonWalletAddress); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, this.neonWalletAddress, splToken); + const { neonKeys, neonTransaction } = yield createClaimInstruction(this.proxyApi, signedTransaction); + return { neonKeys, neonTransaction: signedTransaction, emulateSigner, nonce }; + }); + } + makeTrExecFromDataIx(neonAddress, neonRawTransaction, neonKeys) { + return createExecFromDataInstruction(this.solanaWalletPubkey, neonAddress, this.programId, neonRawTransaction, neonKeys, this.proxyStatus); + } + getCollateralPoolAddress(collateralPoolIndex) { + return collateralPoolAddress(this.programId, collateralPoolIndex); + } + createNeonTransaction(neonWallet, solanaWallet, splToken, amount) { + return __awaiter(this, void 0, void 0, function* () { + return createMintNeonTransactionWeb3(this.web3, neonWallet, solanaWallet, splToken, amount); + }); + } + solanaTransferTransaction(walletPubkey, mintPubkey, associatedTokenPubkey) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = createMintSolanaTransaction(walletPubkey, mintPubkey, associatedTokenPubkey, this.proxyStatus); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } + // #region Neon -> Solana + createAssociatedTokenAccountInstruction(associatedProgramId, programId, mint, associatedAccount, owner, payer) { + return createAssociatedTokenAccountInstruction(mint, associatedAccount, owner, payer); + } + wrapSOLTransaction(amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = yield createWrapSOLTransaction(this.connection, this.solanaWalletPubkey, amount, splToken); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } + unwrapSOLTransaction(amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = yield createUnwrapSOLTransaction(this.connection, this.solanaWalletPubkey, splToken); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash()).blockhash; + return transaction; + }); + } +} diff --git a/dist/core/deprecated/NeonPortal.d.ts b/dist/types/core/deprecated/NeonPortal.d.ts similarity index 100% rename from dist/core/deprecated/NeonPortal.d.ts rename to dist/types/core/deprecated/NeonPortal.d.ts diff --git a/dist/types/core/deprecated/NeonPortal.js b/dist/types/core/deprecated/NeonPortal.js new file mode 100644 index 00000000..7f7e529a --- /dev/null +++ b/dist/types/core/deprecated/NeonPortal.js @@ -0,0 +1,94 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { InstructionService } from './InstructionService'; +import { createNeonDepositInstruction, createNeonTransferInstruction, neonTransactionDataWeb3, solanaNEONTransferTransaction } from '../neon-transfer'; +import { authorityPoolAddress } from '../utils'; +/** + * @deprecated this code was deprecated and will remove in next releases. + * Please use other methods in neon-transfer.ts file + * For more examples see `examples` folder + */ +export class NeonPortal extends InstructionService { + // Solana -> Neon + createNeonTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + this.emitFunction(events.onBeforeCreateInstruction); + const transaction = yield this.neonTransferTransaction(amount, splToken); + this.emitFunction(events.onBeforeSignTransaction); + try { + const signedTransaction = yield this.solana.signTransaction(transaction); + const signature = yield this.connection.sendRawTransaction(signedTransaction.serialize(), this.solanaOptions); + this.emitFunction(events.onSuccessSign, signature); + } + catch (error) { + this.emitFunction(events.onErrorSign, error); + } + }); + } + // Neon -> Solana + createSolanaTransfer(amount, splToken, events = this.events) { + return __awaiter(this, void 0, void 0, function* () { + this.emitFunction(events.onBeforeCreateInstruction); + const transaction = this.ethereumTransaction(amount, splToken); + this.emitFunction(events.onBeforeSignTransaction); + try { + const neonTransaction = yield this.web3.eth.sendTransaction(transaction); + this.emitFunction(events.onSuccessSign, undefined, neonTransaction.transactionHash); + } + catch (error) { + this.emitFunction(events.onErrorSign, error); + } + }); + } + neonTransferTransaction(amount, token, serviceWallet, rewardAmount) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = yield solanaNEONTransferTransaction(this.solanaWalletPubkey, this.neonWalletAddress, this.programId, this.tokenMint, token, amount, 111, serviceWallet, rewardAmount); + transaction.recentBlockhash = (yield this.connection.getLatestBlockhash('finalized')).blockhash; + return transaction; + }); + } + createDepositInstruction(solanaPubkey, neonPubkey, depositPubkey, neonWalletAddress, serviceWallet) { + return createNeonDepositInstruction(solanaPubkey, neonPubkey, depositPubkey, neonWalletAddress, this.programId, this.tokenMint, serviceWallet); + } + neonTransferInstruction(solanaWallet, serviceWallet, rewardAmount) { + return createNeonTransferInstruction(this.tokenMint, solanaWallet, serviceWallet, rewardAmount); + } + getAuthorityPoolAddress() { + return authorityPoolAddress(this.programId); + } + createWithdrawEthTransactionData() { + return neonTransactionDataWeb3(this.web3, this.solanaWalletPubkey); + } + ethereumTransaction(amount, token) { + const from = this.neonWalletAddress; + const to = this.neonContractAddress; + const value = `0x${BigInt(this.web3.utils.toWei(amount.toString(), 'ether')).toString(16)}`; + const data = this.createWithdrawEthTransactionData(); + return { from, to, value, data }; + } + createWithdrawWNeonTransaction(amount, address) { + const contract = this.neonWrapper2Contract(address); + return contract.methods.withdraw(amount).encodeABI(); + } + wNeonTransaction(amount, token) { + const from = this.neonWalletAddress; + const to = token.address; + const value = `0x0`; + const data = this.createWithdrawWNeonTransaction(this.web3.utils.toWei(amount.toString(), 'ether'), to); + return { from, to, value, data }; + } + neonTransaction(amount, token) { + const from = this.neonWalletAddress; + const to = token.address; + const value = `0x${BigInt(this.web3.utils.toWei(amount.toString(), 'ether')).toString(16)}`; + const data = this.createWithdrawEthTransactionData(); + return { from, to, value, data }; + } +} diff --git a/dist/types/core/deprecated/index.d.ts b/dist/types/core/deprecated/index.d.ts new file mode 100644 index 00000000..43990c81 --- /dev/null +++ b/dist/types/core/deprecated/index.d.ts @@ -0,0 +1,2 @@ +export { NeonPortal } from './NeonPortal'; +export { MintPortal } from './MintPortal'; diff --git a/dist/core/deprecated/index.js b/dist/types/core/deprecated/index.js similarity index 72% rename from dist/core/deprecated/index.js rename to dist/types/core/deprecated/index.js index f90643e3..43990c81 100644 --- a/dist/core/deprecated/index.js +++ b/dist/types/core/deprecated/index.js @@ -1,3 +1,2 @@ export { NeonPortal } from './NeonPortal'; export { MintPortal } from './MintPortal'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/types/core/index.d.ts b/dist/types/core/index.d.ts new file mode 100644 index 00000000..a6fa5408 --- /dev/null +++ b/dist/types/core/index.d.ts @@ -0,0 +1,5 @@ +export * from './deprecated'; +export * from './utils'; +export * from './mint-transfer'; +export * from './neon-transfer'; +export * from './multy-transfer'; diff --git a/dist/core/index.js b/dist/types/core/index.js similarity index 82% rename from dist/core/index.js rename to dist/types/core/index.js index f66b40a4..a6fa5408 100644 --- a/dist/core/index.js +++ b/dist/types/core/index.js @@ -3,4 +3,3 @@ export * from './utils'; export * from './mint-transfer'; export * from './neon-transfer'; export * from './multy-transfer'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/core/mint-transfer.d.ts b/dist/types/core/mint-transfer.d.ts similarity index 87% rename from dist/core/mint-transfer.d.ts rename to dist/types/core/mint-transfer.d.ts index bc45f9dd..03293dd4 100644 --- a/dist/core/mint-transfer.d.ts +++ b/dist/types/core/mint-transfer.d.ts @@ -1,7 +1,7 @@ import { AccountMeta, Connection, PublicKey, Transaction, TransactionInstruction } from '@solana/web3.js'; import { Account, SignedTransaction, TransactionConfig } from 'web3-core'; import Web3 from 'web3'; -import { Amount, ClaimInstructionResult, NeonProgramStatus, SolanaAccount, SPLToken } from '../models'; +import { Amount, ClaimInstructionResult, NeonEmulate, NeonProgramStatus, SolanaAccount, SPLToken } from '../models'; import { NeonProxyRpcApi } from '../api'; export declare function neonTransferMintWeb3Transaction(connection: Connection, web3: Web3, proxyApi: NeonProxyRpcApi, proxyStatus: NeonProgramStatus, neonEvmProgram: PublicKey, solanaWallet: PublicKey, neonWallet: string, splToken: SPLToken, amount: Amount, chainId: number): Promise; export declare function neonTransferMintTransaction(connection: Connection, proxyStatus: NeonProgramStatus, neonEvmProgram: PublicKey, solanaWallet: PublicKey, neonWallet: string, emulateSigner: Account, neonKeys: AccountMeta[], legacyAccounts: SolanaAccount[], neonTransaction: SignedTransaction, splToken: SPLToken, amount: bigint, chainId: number): Promise; @@ -11,13 +11,14 @@ export declare function createApproveDepositInstruction(solanaWallet: PublicKey, export declare function createAccountV3Instruction(solanaWallet: PublicKey, neonPDAWallet: PublicKey, neonEvmProgram: PublicKey, neonWallet: string): TransactionInstruction; export declare function createAccountBalanceForLegacyAccountInstruction(connection: Connection, account: SolanaAccount, solanaWallet: PublicKey, neonEvmProgram: PublicKey, chainId: number): Promise; export declare function createAccountBalanceInstruction(solanaWallet: PublicKey, neonEvmProgram: PublicKey, neonWallet: string, chainId: number): TransactionInstruction; -export declare function climeTransactionData(web3: Web3, associatedToken: PublicKey, neonWallet: string, amount: Amount): string; +export declare function climeTransactionDataWeb3(web3: Web3, associatedToken: PublicKey, neonWallet: string, amount: Amount): string; export declare function neonClaimTransactionFromSigner(climeData: string, walletSigner: Account, neonWallet: string, splToken: SPLToken): Promise; +export declare function createClaimInstructionKeys(neonEmulate: NeonEmulate): ClaimInstructionResult; export declare function createClaimInstruction(proxyApi: NeonProxyRpcApi, neonTransaction: SignedTransaction): Promise; export declare function createExecFromDataInstruction(solanaWallet: PublicKey, neonPDAWallet: PublicKey, neonEvmProgram: PublicKey, neonRawTransaction: string, neonKeys: AccountMeta[], proxyStatus: NeonProgramStatus): TransactionInstruction; export declare function createExecFromDataInstructionV2(solanaWallet: PublicKey, neonWallet: string, neonEvmProgram: PublicKey, neonRawTransaction: string, neonKeys: AccountMeta[], proxyStatus: NeonProgramStatus, chainId: number): TransactionInstruction; -export declare function createMintNeonWeb3Transaction(web3: Web3, neonWallet: string, associatedToken: PublicKey, splToken: SPLToken, amount: Amount, gasLimit?: number): Promise; -export declare function mintNeonTransactionData(web3: Web3, associatedToken: PublicKey, splToken: SPLToken, amount: Amount): string; +export declare function createMintNeonTransactionWeb3(web3: Web3, neonWallet: string, associatedToken: PublicKey, splToken: SPLToken, amount: Amount, gasLimit?: number): Promise; +export declare function mintNeonTransactionDataWeb3(web3: Web3, associatedToken: PublicKey, splToken: SPLToken, amount: Amount): string; export declare function createMintNeonTransaction(neonWallet: string, splToken: SPLToken, data: string): TransactionConfig; export declare function createMintSolanaTransaction(solanaWallet: PublicKey, tokenMint: PublicKey, associatedToken: PublicKey, proxyStatus: NeonProgramStatus): Transaction; export declare function createAssociatedTokenAccountInstruction(tokenMint: PublicKey, associatedAccount: PublicKey, owner: PublicKey, payer: PublicKey, associatedProgramId?: PublicKey, programId?: PublicKey): TransactionInstruction; diff --git a/dist/types/core/mint-transfer.js b/dist/types/core/mint-transfer.js new file mode 100644 index 00000000..c87ef491 --- /dev/null +++ b/dist/types/core/mint-transfer.js @@ -0,0 +1,304 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { PublicKey, SystemProgram, SYSVAR_RENT_PUBKEY, Transaction, TransactionInstruction } from '@solana/web3.js'; +import { ASSOCIATED_TOKEN_PROGRAM_ID, createApproveInstruction, createCloseAccountInstruction, createSyncNativeInstruction, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID } from '@solana/spl-token'; +import { Buffer } from 'buffer'; +import { numberTo64BitLittleEndian, toBytesInt32, toFullAmount } from '../utils'; +import { COMPUTE_BUDGET_ID, NEON_COMPUTE_UNITS, NEON_HEAP_FRAME, NEON_STATUS_DEVNET_SNAPSHOT } from '../data'; +import { authAccountAddress, collateralPoolAddress, erc20ForSPLContractWeb3, neonBalanceProgramAddress, neonWalletProgramAddress, solanaWalletSigner } from './utils'; +export function neonTransferMintWeb3Transaction(connection, web3, proxyApi, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, splToken, amount, chainId) { + return __awaiter(this, void 0, void 0, function* () { + const fullAmount = toFullAmount(amount, splToken.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), solanaWallet); + const climeData = climeTransactionDataWeb3(web3, associatedTokenAddress, neonWallet, fullAmount); + const walletSigner = solanaWalletSigner(web3, solanaWallet, neonWallet); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); + const { neonKeys, legacyAccounts } = yield createClaimInstruction(proxyApi, signedTransaction); + return neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, chainId); + }); +} +export function neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, emulateSigner, neonKeys, legacyAccounts, neonTransaction, splToken, amount, chainId) { + return __awaiter(this, void 0, void 0, function* () { + const computedBudgetProgram = new PublicKey(COMPUTE_BUDGET_ID); + const [delegatePDA] = authAccountAddress(emulateSigner.address, neonEvmProgram, splToken); + const [neonWalletBalanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const [emulateSignerBalanceAddress] = neonBalanceProgramAddress(emulateSigner.address, neonEvmProgram, chainId); + const neonWalletBalanceAccount = yield connection.getAccountInfo(neonWalletBalanceAddress); + const emulateSignerBalanceAccount = yield connection.getAccountInfo(emulateSignerBalanceAddress); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), solanaWallet); + const transaction = new Transaction({ feePayer: solanaWallet }); + transaction.add(createComputeBudgetHeapFrameInstruction(computedBudgetProgram, proxyStatus)); + transaction.add(createApproveDepositInstruction(solanaWallet, delegatePDA, associatedTokenAddress, amount)); + if (!neonWalletBalanceAccount) { + transaction.add(createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonWallet, chainId)); + } + if (!emulateSignerBalanceAccount) { + transaction.add(createAccountBalanceInstruction(solanaWallet, neonEvmProgram, emulateSigner.address, chainId)); + } + for (const account of legacyAccounts) { + const instruction = yield createAccountBalanceForLegacyAccountInstruction(connection, account, solanaWallet, neonEvmProgram, chainId); + if (instruction) { + transaction.add(instruction); + } + } + if (neonTransaction === null || neonTransaction === void 0 ? void 0 : neonTransaction.rawTransaction) { + transaction.add(createExecFromDataInstructionV2(solanaWallet, neonWallet, neonEvmProgram, neonTransaction.rawTransaction, neonKeys, proxyStatus, chainId)); + } + return transaction; + }); +} +export function createComputeBudgetUtilsInstruction(programId, proxyStatus) { + var _a; + const a = Buffer.from([0x00]); + const b = Buffer.from(toBytesInt32(parseInt((_a = proxyStatus.NEON_COMPUTE_UNITS) !== null && _a !== void 0 ? _a : NEON_COMPUTE_UNITS))); + const c = Buffer.from(toBytesInt32(0)); + const data = Buffer.concat([a, b, c]); + return new TransactionInstruction({ programId, data, keys: [] }); +} +export function createComputeBudgetHeapFrameInstruction(programId, proxyStatus) { + var _a; + const a = Buffer.from([0x01]); + const b = Buffer.from(toBytesInt32(parseInt((_a = proxyStatus.NEON_HEAP_FRAME) !== null && _a !== void 0 ? _a : NEON_HEAP_FRAME))); + const data = Buffer.concat([a, b]); + return new TransactionInstruction({ programId, data, keys: [] }); +} +export function createApproveDepositInstruction(solanaWallet, neonPDAWallet, associatedToken, amount) { + return createApproveInstruction(associatedToken, neonPDAWallet, solanaWallet, amount); +} +export function createAccountV3Instruction(solanaWallet, neonPDAWallet, neonEvmProgram, neonWallet) { + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: neonPDAWallet, isSigner: false, isWritable: true } + ]; + const a = Buffer.from([40 /* EvmInstruction.CreateAccountV03 */]); + const b = Buffer.from(neonWallet.slice(2), 'hex'); + const data = Buffer.concat([a, b]); + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function createAccountBalanceForLegacyAccountInstruction(connection, account, solanaWallet, neonEvmProgram, chainId) { + return __awaiter(this, void 0, void 0, function* () { + const accountAddress = new PublicKey(account.pubkey); + const accountInfo = yield connection.getAccountInfo(accountAddress); + if (accountInfo) { + const neonAddress = `0x${accountInfo === null || accountInfo === void 0 ? void 0 : accountInfo.data.slice(1, 21).toString('hex')}`; + return createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonAddress, chainId); + } + return null; + }); +} +export function createAccountBalanceInstruction(solanaWallet, neonEvmProgram, neonWallet, chainId) { + const [neonWalletAddress] = neonWalletProgramAddress(neonWallet, neonEvmProgram); + const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: balanceAddress, isSigner: false, isWritable: true }, + { pubkey: neonWalletAddress, isSigner: false, isWritable: true } + ]; + const a = Buffer.from([48 /* EvmInstruction.AccountCreateBalance */]); + const b = Buffer.from(neonWallet.slice(2), 'hex'); + const c = numberTo64BitLittleEndian(chainId); + const data = Buffer.concat([a, b, c]); + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function climeTransactionDataWeb3(web3, associatedToken, neonWallet, amount) { + const claimTo = erc20ForSPLContractWeb3(web3).methods.claimTo(associatedToken.toBuffer(), neonWallet, amount); + return claimTo.encodeABI(); +} +export function neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const transaction = { + data: climeData, + gas: `0x5F5E100`, + gasPrice: `0x0`, + from: neonWallet, + to: splToken.address // contract address + }; + return walletSigner.signTransaction(transaction); + }); +} +export function createClaimInstructionKeys(neonEmulate) { + const legacyAccounts = []; + const accountsMap = new Map(); + if (neonEmulate) { + const { accounts = [], solana_accounts = [] } = neonEmulate; + for (const account of accounts) { + const key = account['account']; + accountsMap.set(key, { pubkey: new PublicKey(key), isSigner: false, isWritable: true }); + if (account['contract']) { + const key = account['contract']; + accountsMap.set(key, { pubkey: new PublicKey(key), isSigner: false, isWritable: true }); + } + } + for (const account of solana_accounts) { + const { pubkey, is_legacy, is_writable } = account; + accountsMap.set(pubkey, { + pubkey: new PublicKey(pubkey), + isSigner: false, + isWritable: is_writable + }); + if (is_legacy) { + legacyAccounts.push(account); + } + } + } + return { neonKeys: Array.from(accountsMap.values()), legacyAccounts }; +} +export function createClaimInstruction(proxyApi, neonTransaction) { + return __awaiter(this, void 0, void 0, function* () { + if (neonTransaction.rawTransaction) { + const neonEmulate = yield proxyApi.neonEmulate([neonTransaction.rawTransaction.slice(2)]); + return createClaimInstructionKeys(neonEmulate); + } + return { neonKeys: [], legacyAccounts: [], neonTransaction }; + }); +} +export function createExecFromDataInstruction(solanaWallet, neonPDAWallet, neonEvmProgram, neonRawTransaction, neonKeys, proxyStatus) { + const count = Number(proxyStatus.NEON_POOL_COUNT); + const treasuryPoolIndex = Math.floor(Math.random() * count) % count; + const [treasuryPoolAddress] = collateralPoolAddress(neonEvmProgram, treasuryPoolIndex); + const a = Buffer.from([50 /* EvmInstruction.TransactionExecuteFromInstruction */]); + const b = Buffer.from(toBytesInt32(treasuryPoolIndex)); + const c = Buffer.from(neonRawTransaction.slice(2), 'hex'); + const data = Buffer.concat([a, b, c]); + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: treasuryPoolAddress, isSigner: false, isWritable: true }, + { pubkey: neonPDAWallet, isSigner: false, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: neonEvmProgram, isSigner: false, isWritable: false }, + ...neonKeys + ]; + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function createExecFromDataInstructionV2(solanaWallet, neonWallet, neonEvmProgram, neonRawTransaction, neonKeys, proxyStatus, chainId) { + var _a; + const count = Number((_a = proxyStatus.NEON_POOL_COUNT) !== null && _a !== void 0 ? _a : NEON_STATUS_DEVNET_SNAPSHOT.NEON_POOL_COUNT); + const treasuryPoolIndex = Math.floor(Math.random() * count) % count; + const [balanceAccount] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const [treasuryPoolAddress] = collateralPoolAddress(neonEvmProgram, treasuryPoolIndex); + const a = Buffer.from([50 /* EvmInstruction.TransactionExecuteFromInstruction */]); + const b = Buffer.from(toBytesInt32(treasuryPoolIndex)); + const c = Buffer.from(neonRawTransaction.slice(2), 'hex'); + const data = Buffer.concat([a, b, c]); + const keys = [ + { pubkey: solanaWallet, isSigner: true, isWritable: true }, + { pubkey: treasuryPoolAddress, isSigner: false, isWritable: true }, + { pubkey: balanceAccount, isSigner: false, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: true }, + ...neonKeys + ]; + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function createMintNeonTransactionWeb3(web3, neonWallet, associatedToken, splToken, amount, gasLimit = 5e4) { + return __awaiter(this, void 0, void 0, function* () { + const data = mintNeonTransactionDataWeb3(web3, associatedToken, splToken, amount); + const transaction = createMintNeonTransaction(neonWallet, splToken, data); + transaction.gasPrice = yield web3.eth.getGasPrice(); + transaction.gas = yield web3.eth.estimateGas(transaction); + transaction.nonce = (yield web3.eth.getTransactionCount(neonWallet)); + // @ts-ignore + transaction['gasLimit'] = transaction.gas > gasLimit ? transaction.gas + 1e4 : gasLimit; + return transaction; + }); +} +export function mintNeonTransactionDataWeb3(web3, associatedToken, splToken, amount) { + const fullAmount = toFullAmount(amount, splToken.decimals); + return erc20ForSPLContractWeb3(web3).methods.transferSolana(associatedToken.toBuffer(), fullAmount).encodeABI(); +} +export function createMintNeonTransaction(neonWallet, splToken, data) { + return { data, from: neonWallet, to: splToken.address, value: `0x0` }; +} +export function createMintSolanaTransaction(solanaWallet, tokenMint, associatedToken, proxyStatus) { + const computedBudgetProgram = new PublicKey(COMPUTE_BUDGET_ID); + const transaction = new Transaction({ feePayer: solanaWallet }); + // transaction.add(createComputeBudgetUtilsInstruction(computedBudgetProgram, proxyStatus)); + transaction.add(createComputeBudgetHeapFrameInstruction(computedBudgetProgram, proxyStatus)); + transaction.add(createAssociatedTokenAccountInstruction(tokenMint, associatedToken, solanaWallet, solanaWallet)); + return transaction; +} +// #region Neon -> Solana +export function createAssociatedTokenAccountInstruction(tokenMint, associatedAccount, owner, payer, associatedProgramId = ASSOCIATED_TOKEN_PROGRAM_ID, programId = TOKEN_PROGRAM_ID) { + const data = Buffer.from([0x01]); + const keys = [ + { pubkey: payer, isSigner: true, isWritable: true }, + { pubkey: associatedAccount, isSigner: false, isWritable: true }, + { pubkey: owner, isSigner: false, isWritable: false }, + { pubkey: tokenMint, isSigner: false, isWritable: false }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false }, + { pubkey: programId, isSigner: false, isWritable: false }, + { pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false } + ]; + return new TransactionInstruction({ programId: associatedProgramId, keys, data }); +} +export function createWrapSOLTransaction(connection, solanaWallet, amount, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const tokenMint = new PublicKey(splToken.address_spl); + const lamports = toFullAmount(amount, splToken.decimals); + const associatedToken = getAssociatedTokenAddressSync(tokenMint, solanaWallet); + const wSOLAccount = yield connection.getAccountInfo(associatedToken); + const transaction = new Transaction({ feePayer: solanaWallet }); + const instructions = []; + if (!wSOLAccount) { + instructions.push(createAssociatedTokenAccountInstruction(tokenMint, associatedToken, solanaWallet, solanaWallet)); + } + instructions.push(SystemProgram.transfer({ + fromPubkey: solanaWallet, + toPubkey: associatedToken, + lamports + })); + instructions.push(createSyncNativeInstruction(associatedToken, TOKEN_PROGRAM_ID)); + transaction.add(...instructions); + return transaction; + }); +} +export function createUnwrapSOLTransaction(connection, solanaWallet, splToken) { + return __awaiter(this, void 0, void 0, function* () { + const tokenMint = new PublicKey(splToken.address_spl); + const associatedToken = getAssociatedTokenAddressSync(tokenMint, solanaWallet); + const wSOLAccount = yield connection.getAccountInfo(associatedToken); + if (!wSOLAccount) { + throw new Error(`Error: ${associatedToken.toBase58()} haven't created account...`); + } + const transaction = new Transaction({ feePayer: solanaWallet }); + const instructions = []; + instructions.push(createCloseAccountInstruction(associatedToken, solanaWallet, solanaWallet)); + transaction.add(...instructions); + return transaction; + }); +} +export function createWrapAndTransferSOLTransactionWeb3(connection, web3, proxyApi, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, splToken, amount, chainId = 111) { + return __awaiter(this, void 0, void 0, function* () { + const instructions = []; + const transaction = new Transaction({ feePayer: solanaWallet }); + const tokenMint = new PublicKey(splToken.address_spl); + const fullAmount = toFullAmount(amount, splToken.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(tokenMint, solanaWallet); + const wSOLAccount = yield connection.getAccountInfo(associatedTokenAddress); + const climeData = climeTransactionDataWeb3(web3, associatedTokenAddress, neonWallet, fullAmount); + const walletSigner = solanaWalletSigner(web3, solanaWallet, neonWallet); + const signedTransaction = yield neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); + const { neonKeys, legacyAccounts } = yield createClaimInstruction(proxyApi, signedTransaction); + const mintTransaction = yield neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, chainId); + if (!wSOLAccount) { + instructions.push(createAssociatedTokenAccountInstruction(tokenMint, associatedTokenAddress, solanaWallet, solanaWallet)); + } + instructions.push(SystemProgram.transfer({ + fromPubkey: solanaWallet, + toPubkey: associatedTokenAddress, + lamports: fullAmount + })); + instructions.push(createSyncNativeInstruction(associatedTokenAddress, TOKEN_PROGRAM_ID)); + transaction.add(...instructions); + transaction.add(...mintTransaction.instructions); + return transaction; + }); +} diff --git a/dist/core/multy-transfer.d.ts b/dist/types/core/multy-transfer.d.ts similarity index 100% rename from dist/core/multy-transfer.d.ts rename to dist/types/core/multy-transfer.d.ts diff --git a/dist/types/core/multy-transfer.js b/dist/types/core/multy-transfer.js new file mode 100644 index 00000000..94992e37 --- /dev/null +++ b/dist/types/core/multy-transfer.js @@ -0,0 +1,26 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { PublicKey } from '@solana/web3.js'; +import { createApproveInstruction, getAssociatedTokenAddressSync } from '@solana/spl-token'; +import { neonBalanceProgramAddress } from './utils'; +import { toFullAmount } from '../utils'; +import { createNeonDepositToBalanceInstruction } from './neon-transfer'; +import { createWrapSOLTransaction } from './mint-transfer'; +export function solanaSOLTransferTransaction(connection, solanaWallet, neonWallet, neonEvmProgram, neonTokenMint, token, amount, chainId = 111) { + return __awaiter(this, void 0, void 0, function* () { + const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const fullAmount = toFullAmount(amount, token.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(token.address_spl), solanaWallet); + const transaction = yield createWrapSOLTransaction(connection, solanaWallet, amount, token); + transaction.add(createApproveInstruction(associatedTokenAddress, balanceAddress, solanaWallet, fullAmount)); + transaction.add(createNeonDepositToBalanceInstruction(chainId, solanaWallet, associatedTokenAddress, neonWallet, neonEvmProgram, neonTokenMint)); + return transaction; + }); +} diff --git a/dist/core/neon-transfer.d.ts b/dist/types/core/neon-transfer.d.ts similarity index 85% rename from dist/core/neon-transfer.d.ts rename to dist/types/core/neon-transfer.d.ts index 6aec0330..3b118e61 100644 --- a/dist/core/neon-transfer.d.ts +++ b/dist/types/core/neon-transfer.d.ts @@ -6,8 +6,8 @@ export declare function solanaNEONTransferTransaction(solanaWallet: PublicKey, n export declare function createNeonDepositToBalanceInstruction(chainId: number, solanaWallet: PublicKey, tokenAddress: PublicKey, neonWallet: string, neonEvmProgram: PublicKey, tokenMint: PublicKey, serviceWallet?: PublicKey): TransactionInstruction; export declare function createNeonDepositInstruction(solanaWallet: PublicKey, neonPDAWallet: PublicKey, depositWallet: PublicKey, neonWallet: string, neonEvmProgram: PublicKey, neonTokenMint: PublicKey, serviceWallet?: PublicKey): TransactionInstruction; export declare function createNeonTransferInstruction(neonTokenMint: PublicKey, solanaWallet: PublicKey, serviceWallet: PublicKey, rewardAmount: Amount): TransactionInstruction; -export declare function neonTransactionData(web3: Web3, solanaWallet: PublicKey): string; -export declare function wrappedNeonTransactionData(web3: Web3, token: SPLToken, amount: Amount): string; +export declare function neonTransactionDataWeb3(web3: Web3, solanaWallet: PublicKey): string; +export declare function wrappedNeonTransactionDataWeb3(web3: Web3, token: SPLToken, amount: Amount): string; export declare function wrappedNeonTransaction(from: string, to: string, data: string): TransactionConfig; export declare function neonNeonTransaction(from: string, to: string, amount: Amount, data: string): TransactionConfig; -export declare function neonNeonWeb3Transaction(web3: Web3, from: string, to: string, solanaWallet: PublicKey, amount: Amount, gasLimit?: number): Promise; +export declare function neonNeonTransactionWeb3(web3: Web3, from: string, to: string, solanaWallet: PublicKey, amount: Amount, gasLimit?: number): Promise; diff --git a/dist/types/core/neon-transfer.js b/dist/types/core/neon-transfer.js new file mode 100644 index 00000000..96dbf500 --- /dev/null +++ b/dist/types/core/neon-transfer.js @@ -0,0 +1,110 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +import { PublicKey, SystemProgram, Transaction, TransactionInstruction } from '@solana/web3.js'; +import { createApproveInstruction, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, TokenInstruction, transferInstructionData } from '@solana/spl-token'; +import { toWei } from 'web3-utils'; +import { numberTo64BitLittleEndian, toBigInt, toFullAmount } from '../utils'; +import { NEON_TOKEN_DECIMALS } from '../data'; +import { authorityPoolAddress, neonBalanceProgramAddress, neonWalletProgramAddress, neonWrapper2ContractWeb3, neonWrapperContractWeb3 } from './utils'; +export function solanaNEONTransferTransaction(solanaWallet, neonWallet, neonEvmProgram, neonTokenMint, token, amount, chainId = 111, serviceWallet, rewardAmount) { + return __awaiter(this, void 0, void 0, function* () { + const neonToken = Object.assign(Object.assign({}, token), { decimals: Number(NEON_TOKEN_DECIMALS) }); + const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const fullAmount = toFullAmount(amount, neonToken.decimals); + const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(neonToken.address_spl), solanaWallet); + const transaction = new Transaction({ feePayer: solanaWallet }); + transaction.add(createApproveInstruction(associatedTokenAddress, balanceAddress, solanaWallet, fullAmount)); + transaction.add(createNeonDepositToBalanceInstruction(chainId, solanaWallet, associatedTokenAddress, neonWallet, neonEvmProgram, neonTokenMint, serviceWallet)); + if (serviceWallet && rewardAmount) { + transaction.add(createNeonTransferInstruction(neonTokenMint, solanaWallet, serviceWallet, rewardAmount)); + } + return transaction; + }); +} +export function createNeonDepositToBalanceInstruction(chainId, solanaWallet, tokenAddress, neonWallet, neonEvmProgram, tokenMint, serviceWallet) { + const [depositWallet] = authorityPoolAddress(neonEvmProgram); + const [balanceAddress] = neonBalanceProgramAddress(neonWallet, neonEvmProgram, chainId); + const [contractAddress] = neonWalletProgramAddress(neonWallet, neonEvmProgram); + const poolAddress = getAssociatedTokenAddressSync(tokenMint, depositWallet, true); + const keys = [ + { pubkey: tokenMint, isSigner: false, isWritable: true }, + { pubkey: tokenAddress, isSigner: false, isWritable: true }, + { pubkey: poolAddress, isSigner: false, isWritable: true }, + { pubkey: balanceAddress, isSigner: false, isWritable: true }, + { pubkey: contractAddress, isSigner: false, isWritable: true }, + { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, + { pubkey: serviceWallet ? serviceWallet : solanaWallet, isSigner: true, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false } + ]; + const a = Buffer.from([49 /* EvmInstruction.DepositToBalance */]); + const b = Buffer.from(neonWallet.slice(2), 'hex'); + const c = numberTo64BitLittleEndian(chainId); + const data = Buffer.concat([a, b, c]); + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function createNeonDepositInstruction(solanaWallet, neonPDAWallet, depositWallet, neonWallet, neonEvmProgram, neonTokenMint, serviceWallet) { + const solanaAssociatedTokenAddress = getAssociatedTokenAddressSync(neonTokenMint, solanaWallet); + const poolKey = getAssociatedTokenAddressSync(neonTokenMint, depositWallet, true); + const keys = [ + { pubkey: solanaAssociatedTokenAddress, isSigner: false, isWritable: true }, + { pubkey: poolKey, isSigner: false, isWritable: true }, + { pubkey: neonPDAWallet, isSigner: false, isWritable: true }, + { pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false }, + { pubkey: serviceWallet ? serviceWallet : solanaWallet, isSigner: true, isWritable: true }, + { pubkey: SystemProgram.programId, isSigner: false, isWritable: false } + ]; + const a = Buffer.from([39 /* EvmInstruction.DepositV03 */]); + const b = Buffer.from(neonWallet.slice(2), 'hex'); + const data = Buffer.concat([a, b]); + return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); +} +export function createNeonTransferInstruction(neonTokenMint, solanaWallet, serviceWallet, rewardAmount) { + const from = getAssociatedTokenAddressSync(neonTokenMint, solanaWallet, true); + const to = getAssociatedTokenAddressSync(neonTokenMint, serviceWallet, true); + const fullAmount = toBigInt(rewardAmount); + const keys = [ + { pubkey: from, isSigner: false, isWritable: true }, + { pubkey: to, isSigner: false, isWritable: true }, + { pubkey: solanaWallet, isSigner: true, isWritable: false } + ]; + const data = Buffer.alloc(transferInstructionData.span); + transferInstructionData.encode({ + instruction: TokenInstruction.Transfer, + amount: fullAmount + }, data); + return new TransactionInstruction({ programId: TOKEN_PROGRAM_ID, keys, data }); +} +export function neonTransactionDataWeb3(web3, solanaWallet) { + return neonWrapperContractWeb3(web3).methods.withdraw(solanaWallet.toBuffer()).encodeABI(); +} +export function wrappedNeonTransactionDataWeb3(web3, token, amount) { + const value = toWei(amount.toString(), 'ether'); + const contract = neonWrapper2ContractWeb3(web3, token.address); + return contract.methods.withdraw(value).encodeABI(); +} +export function wrappedNeonTransaction(from, to, data) { + const value = `0x0`; + return { from, to, value, data }; +} +export function neonNeonTransaction(from, to, amount, data) { + const value = `0x${BigInt(toWei(amount.toString(), 'ether')).toString(16)}`; + return { from, to, value, data }; +} +export function neonNeonTransactionWeb3(web3, from, to, solanaWallet, amount, gasLimit = 5e4) { + return __awaiter(this, void 0, void 0, function* () { + const data = neonTransactionDataWeb3(web3, solanaWallet); + const transaction = neonNeonTransaction(from, to, amount, data); + transaction.gasPrice = yield web3.eth.getGasPrice(); + transaction.gas = yield web3.eth.estimateGas(transaction); + // @ts-ignore + transaction['gasLimit'] = transaction.gas > gasLimit ? transaction.gas + 1e4 : gasLimit; + return transaction; + }); +} diff --git a/dist/core/utils/accounts.d.ts b/dist/types/core/utils/accounts.d.ts similarity index 100% rename from dist/core/utils/accounts.d.ts rename to dist/types/core/utils/accounts.d.ts diff --git a/dist/types/core/utils/accounts.js b/dist/types/core/utils/accounts.js new file mode 100644 index 00000000..48d0c712 --- /dev/null +++ b/dist/types/core/utils/accounts.js @@ -0,0 +1,5 @@ +import { SHA256 } from 'crypto-js'; +export function solanaWalletSigner(web3, solanaWallet, neonWallet) { + const emulateSignerPrivateKey = `0x${SHA256(solanaWallet.toBase58() + neonWallet).toString()}`; + return web3.eth.accounts.privateKeyToAccount(emulateSignerPrivateKey); +} diff --git a/dist/core/utils/addresses.d.ts b/dist/types/core/utils/addresses.d.ts similarity index 100% rename from dist/core/utils/addresses.d.ts rename to dist/types/core/utils/addresses.d.ts diff --git a/dist/types/core/utils/addresses.js b/dist/types/core/utils/addresses.js new file mode 100644 index 00000000..49250ea9 --- /dev/null +++ b/dist/types/core/utils/addresses.js @@ -0,0 +1,37 @@ +import { PublicKey } from '@solana/web3.js'; +import { Buffer } from 'buffer'; +import { isValidHex, toBytesInt32, toU256BE } from '../../utils'; +export function neonWalletProgramAddress(etherKey, neonEvmProgram) { + const keyBuffer = Buffer.from(isValidHex(etherKey) ? etherKey.replace(/^0x/i, '') : etherKey, 'hex'); + const seed = [new Uint8Array([3 /* AccountHex.SeedVersion */]), new Uint8Array(keyBuffer)]; + return PublicKey.findProgramAddressSync(seed, neonEvmProgram); +} +export function neonBalanceProgramAddress(etherKey, neonEvmProgram, chainId) { + const keyBuffer = Buffer.from(isValidHex(etherKey) ? etherKey.replace(/^0x/i, '') : etherKey, 'hex'); + const chainIdBytes = toU256BE(BigInt(chainId)); //chain_id as u256be + const seed = [ + new Uint8Array([3 /* AccountHex.SeedVersion */]), + new Uint8Array(keyBuffer), + chainIdBytes + ]; + return PublicKey.findProgramAddressSync(seed, neonEvmProgram); +} +export function authAccountAddress(neonWallet, neonEvmProgram, splToken) { + const neonAccountAddressBytes = Buffer.concat([Buffer.alloc(12), Buffer.from(isValidHex(neonWallet) ? neonWallet.replace(/^0x/i, '') : neonWallet, 'hex')]); + const neonContractAddressBytes = Buffer.from(isValidHex(splToken.address) ? splToken.address.replace(/^0x/i, '') : splToken.address, 'hex'); + const seed = [ + new Uint8Array([3 /* AccountHex.SeedVersion */]), + new Uint8Array(Buffer.from('AUTH', 'utf-8')), + new Uint8Array(neonContractAddressBytes), + new Uint8Array(neonAccountAddressBytes) + ]; + return PublicKey.findProgramAddressSync(seed, neonEvmProgram); +} +export function collateralPoolAddress(neonWalletPDA, collateralPoolIndex) { + const a = Buffer.from('treasury_pool', 'utf8'); + const b = Buffer.from(toBytesInt32(collateralPoolIndex)); + return PublicKey.findProgramAddressSync([a, b], neonWalletPDA); +} +export function authorityPoolAddress(programId) { + return PublicKey.findProgramAddressSync([new Uint8Array(Buffer.from('Deposit', 'utf-8'))], programId); +} diff --git a/dist/types/core/utils/contracts.d.ts b/dist/types/core/utils/contracts.d.ts new file mode 100644 index 00000000..540e48f0 --- /dev/null +++ b/dist/types/core/utils/contracts.d.ts @@ -0,0 +1,5 @@ +import { Contract } from 'web3-eth-contract'; +import Web3 from 'web3'; +export declare function erc20ForSPLContractWeb3(web3: Web3): Contract; +export declare function neonWrapperContractWeb3(web3: Web3): Contract; +export declare function neonWrapper2ContractWeb3(web3: Web3, address: string): Contract; diff --git a/dist/types/core/utils/contracts.js b/dist/types/core/utils/contracts.js new file mode 100644 index 00000000..ef9aeeff --- /dev/null +++ b/dist/types/core/utils/contracts.js @@ -0,0 +1,10 @@ +import { erc20Abi, neonWrapper2Abi, neonWrapperAbi } from '../../data'; +export function erc20ForSPLContractWeb3(web3) { + return new web3.eth.Contract(erc20Abi); +} +export function neonWrapperContractWeb3(web3) { + return new web3.eth.Contract(neonWrapperAbi); +} +export function neonWrapper2ContractWeb3(web3, address) { + return new web3.eth.Contract(neonWrapper2Abi, address); +} diff --git a/dist/types/core/utils/index.d.ts b/dist/types/core/utils/index.d.ts new file mode 100644 index 00000000..a8d23d46 --- /dev/null +++ b/dist/types/core/utils/index.d.ts @@ -0,0 +1,3 @@ +export * from './accounts'; +export * from './addresses'; +export * from './contracts'; diff --git a/dist/core/utils/index.js b/dist/types/core/utils/index.js similarity index 72% rename from dist/core/utils/index.js rename to dist/types/core/utils/index.js index edc2c386..a8d23d46 100644 --- a/dist/core/utils/index.js +++ b/dist/types/core/utils/index.js @@ -1,4 +1,3 @@ export * from './accounts'; export * from './addresses'; export * from './contracts'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/data/abi/erc20.d.ts b/dist/types/data/abi/erc20.d.ts similarity index 100% rename from dist/data/abi/erc20.d.ts rename to dist/types/data/abi/erc20.d.ts diff --git a/dist/types/data/abi/erc20.js b/dist/types/data/abi/erc20.js new file mode 100644 index 00000000..7b2bb9da --- /dev/null +++ b/dist/types/data/abi/erc20.js @@ -0,0 +1,453 @@ +export const erc20Abi = [ + { + 'inputs': [ + { + 'internalType': 'string', + 'name': '_name', + 'type': 'string' + }, + { + 'internalType': 'string', + 'name': '_symbol', + 'type': 'string' + }, + { + 'internalType': 'bytes32', + 'name': '_tokenMint', + 'type': 'bytes32' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'constructor' + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'internalType': 'address', + 'name': 'owner', + 'type': 'address' + }, + { + 'indexed': true, + 'internalType': 'address', + 'name': 'spender', + 'type': 'address' + }, + { + 'indexed': false, + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'Approval', + 'type': 'event' + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'internalType': 'address', + 'name': 'owner', + 'type': 'address' + }, + { + 'indexed': true, + 'internalType': 'bytes32', + 'name': 'spender', + 'type': 'bytes32' + }, + { + 'indexed': false, + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'ApprovalSolana', + 'type': 'event' + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'internalType': 'address', + 'name': 'from', + 'type': 'address' + }, + { + 'indexed': true, + 'internalType': 'address', + 'name': 'to', + 'type': 'address' + }, + { + 'indexed': false, + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'Transfer', + 'type': 'event' + }, + { + 'anonymous': false, + 'inputs': [ + { + 'indexed': true, + 'internalType': 'address', + 'name': 'from', + 'type': 'address' + }, + { + 'indexed': true, + 'internalType': 'bytes32', + 'name': 'to', + 'type': 'bytes32' + }, + { + 'indexed': false, + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'TransferSolana', + 'type': 'event' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'owner', + 'type': 'address' + }, + { + 'internalType': 'address', + 'name': 'spender', + 'type': 'address' + } + ], + 'name': 'allowance', + 'outputs': [ + { + 'internalType': 'uint256', + 'name': '', + 'type': 'uint256' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'spender', + 'type': 'address' + }, + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'approve', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': 'spender', + 'type': 'bytes32' + }, + { + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'approveSolana', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'who', + 'type': 'address' + } + ], + 'name': 'balanceOf', + 'outputs': [ + { + 'internalType': 'uint256', + 'name': '', + 'type': 'uint256' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'burn', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'from', + 'type': 'address' + }, + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'burnFrom', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': 'from', + 'type': 'bytes32' + }, + { + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'claim', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': 'from', + 'type': 'bytes32' + }, + { + 'internalType': 'address', + 'name': 'to', + 'type': 'address' + }, + { + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'claimTo', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'decimals', + 'outputs': [ + { + 'internalType': 'uint8', + 'name': '', + 'type': 'uint8' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'name', + 'outputs': [ + { + 'internalType': 'string', + 'name': '', + 'type': 'string' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'symbol', + 'outputs': [ + { + 'internalType': 'string', + 'name': '', + 'type': 'string' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'tokenMint', + 'outputs': [ + { + 'internalType': 'bytes32', + 'name': '', + 'type': 'bytes32' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [], + 'name': 'totalSupply', + 'outputs': [ + { + 'internalType': 'uint256', + 'name': '', + 'type': 'uint256' + } + ], + 'stateMutability': 'view', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'to', + 'type': 'address' + }, + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'transfer', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'address', + 'name': 'from', + 'type': 'address' + }, + { + 'internalType': 'address', + 'name': 'to', + 'type': 'address' + }, + { + 'internalType': 'uint256', + 'name': 'amount', + 'type': 'uint256' + } + ], + 'name': 'transferFrom', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + }, + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': 'to', + 'type': 'bytes32' + }, + { + 'internalType': 'uint64', + 'name': 'amount', + 'type': 'uint64' + } + ], + 'name': 'transferSolana', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'nonpayable', + 'type': 'function' + } +]; +export default erc20Abi; diff --git a/dist/types/data/abi/index.d.ts b/dist/types/data/abi/index.d.ts new file mode 100644 index 00000000..6e01fd2b --- /dev/null +++ b/dist/types/data/abi/index.d.ts @@ -0,0 +1,3 @@ +export * from './erc20'; +export * from './neonWrapper'; +export * from './neonWrapper2'; diff --git a/dist/data/abi/index.js b/dist/types/data/abi/index.js similarity index 72% rename from dist/data/abi/index.js rename to dist/types/data/abi/index.js index d88657b3..6e01fd2b 100644 --- a/dist/data/abi/index.js +++ b/dist/types/data/abi/index.js @@ -1,4 +1,3 @@ export * from './erc20'; export * from './neonWrapper'; export * from './neonWrapper2'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/data/abi/neonWrapper.d.ts b/dist/types/data/abi/neonWrapper.d.ts similarity index 100% rename from dist/data/abi/neonWrapper.d.ts rename to dist/types/data/abi/neonWrapper.d.ts diff --git a/dist/types/data/abi/neonWrapper.js b/dist/types/data/abi/neonWrapper.js new file mode 100644 index 00000000..1fee5a52 --- /dev/null +++ b/dist/types/data/abi/neonWrapper.js @@ -0,0 +1,22 @@ +export const neonWrapperAbi = [ + { + 'inputs': [ + { + 'internalType': 'bytes32', + 'name': '', + 'type': 'bytes32' + } + ], + 'name': 'withdraw', + 'outputs': [ + { + 'internalType': 'bool', + 'name': '', + 'type': 'bool' + } + ], + 'stateMutability': 'payable', + 'type': 'function' + } +]; +export default neonWrapperAbi; diff --git a/dist/data/abi/neonWrapper2.d.ts b/dist/types/data/abi/neonWrapper2.d.ts similarity index 100% rename from dist/data/abi/neonWrapper2.d.ts rename to dist/types/data/abi/neonWrapper2.d.ts diff --git a/dist/types/data/abi/neonWrapper2.js b/dist/types/data/abi/neonWrapper2.js new file mode 100644 index 00000000..2d1edf94 --- /dev/null +++ b/dist/types/data/abi/neonWrapper2.js @@ -0,0 +1,129 @@ +export const neonWrapper2Abi = [{ + 'constant': true, + 'inputs': [], + 'name': 'name', + 'outputs': [{ 'name': '', 'type': 'string' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [{ 'name': 'guy', 'type': 'address' }, { 'name': 'wad', 'type': 'uint256' }], + 'name': 'approve', + 'outputs': [{ 'name': '', 'type': 'bool' }], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [], + 'name': 'totalSupply', + 'outputs': [{ 'name': '', 'type': 'uint256' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [{ 'name': 'src', 'type': 'address' }, { + 'name': 'dst', + 'type': 'address' + }, { 'name': 'wad', 'type': 'uint256' }], + 'name': 'transferFrom', + 'outputs': [{ 'name': '', 'type': 'bool' }], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [{ 'name': 'wad', 'type': 'uint256' }], + 'name': 'withdraw', + 'outputs': [], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [], + 'name': 'decimals', + 'outputs': [{ 'name': '', 'type': 'uint8' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [{ 'name': '', 'type': 'address' }], + 'name': 'balanceOf', + 'outputs': [{ 'name': '', 'type': 'uint256' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [], + 'name': 'symbol', + 'outputs': [{ 'name': '', 'type': 'string' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [{ 'name': 'dst', 'type': 'address' }, { 'name': 'wad', 'type': 'uint256' }], + 'name': 'transfer', + 'outputs': [{ 'name': '', 'type': 'bool' }], + 'payable': false, + 'stateMutability': 'nonpayable', + 'type': 'function' + }, { + 'constant': false, + 'inputs': [], + 'name': 'deposit', + 'outputs': [], + 'payable': true, + 'stateMutability': 'payable', + 'type': 'function' + }, { + 'constant': true, + 'inputs': [{ 'name': '', 'type': 'address' }, { 'name': '', 'type': 'address' }], + 'name': 'allowance', + 'outputs': [{ 'name': '', 'type': 'uint256' }], + 'payable': false, + 'stateMutability': 'view', + 'type': 'function' + }, { 'payable': true, 'stateMutability': 'payable', 'type': 'fallback' }, { + 'anonymous': false, + 'inputs': [{ 'indexed': true, 'name': 'src', 'type': 'address' }, { + 'indexed': true, + 'name': 'guy', + 'type': 'address' + }, { 'indexed': false, 'name': 'wad', 'type': 'uint256' }], + 'name': 'Approval', + 'type': 'event' + }, { + 'anonymous': false, + 'inputs': [{ 'indexed': true, 'name': 'src', 'type': 'address' }, { + 'indexed': true, + 'name': 'dst', + 'type': 'address' + }, { 'indexed': false, 'name': 'wad', 'type': 'uint256' }], + 'name': 'Transfer', + 'type': 'event' + }, { + 'anonymous': false, + 'inputs': [{ 'indexed': true, 'name': 'dst', 'type': 'address' }, { + 'indexed': false, + 'name': 'wad', + 'type': 'uint256' + }], + 'name': 'Deposit', + 'type': 'event' + }, { + 'anonymous': false, + 'inputs': [{ 'indexed': true, 'name': 'src', 'type': 'address' }, { + 'indexed': false, + 'name': 'wad', + 'type': 'uint256' + }], + 'name': 'Withdrawal', + 'type': 'event' + }]; +export default neonWrapper2Abi; diff --git a/dist/data/constants.d.ts b/dist/types/data/constants.d.ts similarity index 100% rename from dist/data/constants.d.ts rename to dist/types/data/constants.d.ts diff --git a/dist/types/data/constants.js b/dist/types/data/constants.js new file mode 100644 index 00000000..d1c7a80c --- /dev/null +++ b/dist/types/data/constants.js @@ -0,0 +1,16 @@ +export const NEON_TOKEN_DECIMALS = 9; +export const NEON_TOKEN_MINT_DECIMALS = 18; +export const NEON_TRANSFER_CONTRACT_DEVNET = '0x5238c694a8db837fff8c4068859e765b978a7607'; +export const SOL_TRANSFER_CONTRACT_DEVNET = '0xf9949Ae1f5982181d163B1f095b010CeD2e8D6f7'; +export const NEON_TRANSFER_CONTRACT_TESTNET = '0x5238c694a8db837fff8c4068859e765b978a7607'; +export const NEON_TRANSFER_CONTRACT_MAINNET = '0xaC6FEaF379B01e3B0888597c53bb37e2B0b513ab'; +export const KECCAK_PROGRAM = 'KeccakSecp256k11111111111111111111111111111'; +export const INCINERATOR_PUBKEY = '1nc1nerator11111111111111111111111111111111'; +export const SYSVAR_INSTRUCTION_PUBKEY = 'Sysvar1nstructions1111111111111111111111111'; +export const COMPUTE_BUDGET_ID = 'ComputeBudget111111111111111111111111111111'; +export const NEON_HEAP_FRAME = '262144'; +export const NEON_COMPUTE_UNITS = '500000'; +export const NEON_TOKEN_MINT_DEVNET = '89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g'; +export const SOL_TOKEN_MINT_DEVNET = '89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g'; +export const NEON_TOKEN_MINT_MAINNET = 'NeonTjSjsuo3rexg9o6vHuMXw62f9V7zvmu8M8Zut44'; +export const SOL_TOKEN_MINT_MAINNET = 'NeonTjSjsuo3rexg9o6vHuMXw62f9V7zvmu8M8Zut44'; diff --git a/dist/types/data/index.d.ts b/dist/types/data/index.d.ts new file mode 100644 index 00000000..4c35ae9d --- /dev/null +++ b/dist/types/data/index.d.ts @@ -0,0 +1,6 @@ +import erc20Abi from './abi/erc20'; +import neonWrapperAbi from './abi/neonWrapper'; +import neonWrapper2Abi from './abi/neonWrapper2'; +export * from './constants'; +export * from './proxy'; +export { erc20Abi, neonWrapperAbi, neonWrapper2Abi }; diff --git a/dist/data/index.js b/dist/types/data/index.js similarity index 88% rename from dist/data/index.js rename to dist/types/data/index.js index 9a5488ab..4c35ae9d 100644 --- a/dist/data/index.js +++ b/dist/types/data/index.js @@ -4,4 +4,3 @@ import neonWrapper2Abi from './abi/neonWrapper2'; export * from './constants'; export * from './proxy'; export { erc20Abi, neonWrapperAbi, neonWrapper2Abi }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/data/proxy.d.ts b/dist/types/data/proxy.d.ts similarity index 100% rename from dist/data/proxy.d.ts rename to dist/types/data/proxy.d.ts diff --git a/dist/types/data/proxy.js b/dist/types/data/proxy.js new file mode 100644 index 00000000..712319fb --- /dev/null +++ b/dist/types/data/proxy.js @@ -0,0 +1,54 @@ +export const NEON_STATUS_MAINNET_SNAPSHOT = { + NEON_ACCOUNT_SEED_VERSION: '3', + NEON_ADDITIONAL_FEE: '0', + NEON_CHAIN_ID: '245022934', + NEON_COMPUTE_BUDGET_HEAP_FRAME: '262144', + NEON_COMPUTE_BUDGET_UNITS: '500000', + NEON_COMPUTE_UNITS: '500000', + NEON_EVM_STEPS_LAST_ITERATION_MAX: '1', + NEON_EVM_STEPS_MIN: '500', + NEON_GAS_LIMIT_MULTIPLIER_NO_CHAINID: '1000', + NEON_HEAP_FRAME: '262144', + NEON_HOLDER_MSG_SIZE: '950', + NEON_OPERATOR_PRIORITY_SLOTS: '16', + NEON_PAYMENT_TO_DEPOSIT: '5000', + NEON_PAYMENT_TO_TREASURE: '5000', + NEON_PKG_VERSION: '1.0.0', + NEON_POOL_COUNT: '128', + NEON_POOL_SEED: 'treasury_pool', + NEON_REQUEST_UNITS_ADDITIONAL_FEE: '0', + NEON_REVISION: '3cece008d1520c1183fbd59370a90b5e5350b9e7', + NEON_SEED_VERSION: '3', + NEON_STATUS_NAME: 'WORK', + NEON_STORAGE_ENTRIES_IN_CONTRACT_ACCOUNT: '64', + NEON_TOKEN_MINT: 'NeonTjSjsuo3rexg9o6vHuMXw62f9V7zvmu8M8Zut44', + NEON_TOKEN_MINT_DECIMALS: '9', + NEON_TREASURY_POOL_COUNT: '128', + NEON_TREASURY_POOL_SEED: 'treasury_pool', + NEON_EVM_ID: 'NeonVMyRX5GbCrsAHnUwx1nYYoJAtskU1bWUo6JGNyG' +}; +export const NEON_STATUS_DEVNET_SNAPSHOT = { + NEON_ACCOUNT_SEED_VERSION: '3', + NEON_EVM_ID: 'eeLSJgWzzxrqKv1UxtRVVH8FX3qCQWUs9QuAjJpETGU', + NEON_EVM_STEPS_LAST_ITERATION_MAX: '1', + NEON_EVM_STEPS_MIN: '500', + NEON_GAS_LIMIT_MULTIPLIER_NO_CHAINID: '1000', + NEON_HOLDER_MSG_SIZE: '950', + NEON_OPERATOR_PRIORITY_SLOTS: '16', + NEON_PAYMENT_TO_TREASURE: '5000', + NEON_STORAGE_ENTRIES_IN_CONTRACT_ACCOUNT: '64', + NEON_TREASURY_POOL_COUNT: '128', + NEON_TREASURY_POOL_SEED: 'treasury_pool' +}; +export const TOKEN_LIST_DEVNET_SNAPSHOT = [{ + token_name: 'NEON', + token_mint: '89dre8rZjLNft7HoupGiyxu3MNftR577ZYu8bHe2kK7g', + token_chain_id: '0xe9ac0ce' + }, { + token_name: 'SOL', + token_mint: 'So11111111111111111111111111111111111111112', + token_chain_id: '0xe9ac0cf' + }]; +const proxyStatusSnapshot = new Map(); +proxyStatusSnapshot.set('mainnet', NEON_STATUS_MAINNET_SNAPSHOT); +proxyStatusSnapshot.set('devnet', NEON_STATUS_DEVNET_SNAPSHOT); diff --git a/dist/types/index.d.ts b/dist/types/index.d.ts new file mode 100644 index 00000000..52705b59 --- /dev/null +++ b/dist/types/index.d.ts @@ -0,0 +1,6 @@ +export * from './api'; +export * from './core'; +export * from './data'; +export * from './models'; +export * from './react'; +export * from './utils'; diff --git a/dist/index.js b/dist/types/index.js similarity index 81% rename from dist/index.js rename to dist/types/index.js index b719e43a..52705b59 100644 --- a/dist/index.js +++ b/dist/types/index.js @@ -4,4 +4,3 @@ export * from './data'; export * from './models'; export * from './react'; export * from './utils'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/models/api.d.ts b/dist/types/models/api.d.ts similarity index 98% rename from dist/models/api.d.ts rename to dist/types/models/api.d.ts index 728d0303..94ba6a78 100644 --- a/dist/models/api.d.ts +++ b/dist/types/models/api.d.ts @@ -69,7 +69,7 @@ export interface NeonAccounts { contract: string; } export interface ClaimInstructionResult { - neonTransaction: SignedTransaction; + neonTransaction?: SignedTransaction; neonKeys: AccountMeta[]; legacyAccounts: SolanaAccount[]; } diff --git a/dist/types/models/api.js b/dist/types/models/api.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/types/models/api.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/models/events.d.ts b/dist/types/models/events.d.ts similarity index 100% rename from dist/models/events.d.ts rename to dist/types/models/events.d.ts diff --git a/dist/types/models/events.js b/dist/types/models/events.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/types/models/events.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/types/models/index.d.ts b/dist/types/models/index.d.ts new file mode 100644 index 00000000..9168a906 --- /dev/null +++ b/dist/types/models/index.d.ts @@ -0,0 +1,4 @@ +export * from './api'; +export * from './events'; +export * from './instruction'; +export * from './token'; diff --git a/dist/models/index.js b/dist/types/models/index.js similarity index 76% rename from dist/models/index.js rename to dist/types/models/index.js index 7269daff..9168a906 100644 --- a/dist/models/index.js +++ b/dist/types/models/index.js @@ -2,4 +2,3 @@ export * from './api'; export * from './events'; export * from './instruction'; export * from './token'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/models/instruction.d.ts b/dist/types/models/instruction.d.ts similarity index 100% rename from dist/models/instruction.d.ts rename to dist/types/models/instruction.d.ts diff --git a/dist/types/models/instruction.js b/dist/types/models/instruction.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/types/models/instruction.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/models/token.d.ts b/dist/types/models/token.d.ts similarity index 100% rename from dist/models/token.d.ts rename to dist/types/models/token.d.ts diff --git a/dist/types/models/token.js b/dist/types/models/token.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/dist/types/models/token.js @@ -0,0 +1 @@ +export {}; diff --git a/dist/types/react/index.d.ts b/dist/types/react/index.d.ts new file mode 100644 index 00000000..cace4b88 --- /dev/null +++ b/dist/types/react/index.d.ts @@ -0,0 +1,2 @@ +export * from './neon-transfer'; +export * from './proxy-status'; diff --git a/dist/react/index.js b/dist/types/react/index.js similarity index 66% rename from dist/react/index.js rename to dist/types/react/index.js index 567bc8db..cace4b88 100644 --- a/dist/react/index.js +++ b/dist/types/react/index.js @@ -1,3 +1,2 @@ export * from './neon-transfer'; export * from './proxy-status'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/react/neon-transfer.d.ts b/dist/types/react/neon-transfer.d.ts similarity index 100% rename from dist/react/neon-transfer.d.ts rename to dist/types/react/neon-transfer.d.ts diff --git a/dist/types/react/neon-transfer.js b/dist/types/react/neon-transfer.js new file mode 100644 index 00000000..15fdf890 --- /dev/null +++ b/dist/types/react/neon-transfer.js @@ -0,0 +1,46 @@ +import { NeonProxyRpcApi } from '../api'; +import { MintPortal, NeonPortal } from '../core'; +import { useProxyInfo } from './proxy-status'; +import { NEON_TRANSFER_CONTRACT_DEVNET } from '../data'; +const urls = process.env.REACT_APP_URLS ? JSON.parse(process.env.REACT_APP_URLS) : { + solanaRpcApi: 'https://api.devnet.solana.com', + neonProxyRpcApi: 'https://devnet.neonevm.org' +}; +export const proxyApi = new NeonProxyRpcApi({ + solanaRpcApi: urls.solanaRpcApi, + neonProxyRpcApi: urls.neonProxyRpcApi +}); +/* +* @deprecated this code was deprecated and will remove in next releases. +* Please, don't use this hock in you codebase, for more details see our React Demo in `examples` folder +* */ +export function useNeonTransfer(events, connection, web3, publicKey, neonWalletAddress, neonContractAddress = NEON_TRANSFER_CONTRACT_DEVNET) { + const proxyStatus = useProxyInfo(proxyApi); + const options = { + connection: connection, + solanaWalletAddress: publicKey, + neonWalletAddress, + neonContractAddress, + web3, + proxyApi: proxyApi, + proxyStatus: proxyStatus + }; + const neonPortal = new NeonPortal(options); + const mintPortal = new MintPortal(options); + const portalInstance = (addr) => { + return proxyStatus.NEON_TOKEN_MINT === addr ? neonPortal : mintPortal; + }; + const getEthereumTransactionParams = (amount, splToken) => { + const portal = portalInstance(splToken.address_spl); + return portal.ethereumTransaction.call(portal, amount, splToken); + }; + const deposit = (amount, splToken) => { + const portal = portalInstance(splToken.address_spl); + return portal.createNeonTransfer.call(portal, amount, splToken, events); + }; + const withdraw = (amount, splToken, to) => { + const portal = portalInstance(splToken.address_spl); + return portal.createSolanaTransfer.call(portal, amount, splToken, events); + }; + return { deposit, withdraw, getEthereumTransactionParams, proxyStatus }; +} diff --git a/dist/react/proxy-status.d.ts b/dist/types/react/proxy-status.d.ts similarity index 100% rename from dist/react/proxy-status.d.ts rename to dist/types/react/proxy-status.d.ts diff --git a/dist/types/react/proxy-status.js b/dist/types/react/proxy-status.js new file mode 100644 index 00000000..9fb77281 --- /dev/null +++ b/dist/types/react/proxy-status.js @@ -0,0 +1,28 @@ +import { useEffect, useState } from 'react'; +export const proxyStatus = 'proxyStatus'; +export function useProxyInfo(api) { + const [status, setStatus] = useState({}); + useEffect(() => { + if ('localStorage' in window) { + const data = localStorage.getItem(proxyStatus); + if (data && data.length > 0) { + try { + const parse = JSON.parse(data); + setStatus(parse); + } + catch (e) { + // + } + } + } + }, []); + useEffect(() => { + api.evmParams().then(result => { + setStatus(result); + if ('localStorage' in window) { + localStorage.setItem(proxyStatus, JSON.stringify(result)); + } + }).catch(e => console.log(e)); + }, [api]); + return status; +} diff --git a/dist/utils/address.d.ts b/dist/types/utils/address.d.ts similarity index 100% rename from dist/utils/address.d.ts rename to dist/types/utils/address.d.ts diff --git a/dist/types/utils/address.js b/dist/types/utils/address.js new file mode 100644 index 00000000..c5f02654 --- /dev/null +++ b/dist/types/utils/address.js @@ -0,0 +1,39 @@ +import Big from 'big.js'; +export function toBytesInt32(number, littleEndian = true) { + const arrayBuffer = new ArrayBuffer(4); // an Int32 takes 4 bytes + const dataView = new DataView(arrayBuffer); + dataView.setUint32(0, number, littleEndian); // byteOffset = 0; litteEndian = false + return arrayBuffer; +} +export function toFullAmount(amount, decimals) { + const data = new Big(amount.toString()).times(Big(10).pow(decimals)); + return BigInt(data.toString()); +} +export function toBigInt(amount) { + const data = new Big(amount.toString()); + return BigInt(data.toString()); +} +export function numberTo64BitLittleEndian(num) { + const buffer = new ArrayBuffer(8); // 64 bits = 8 bytes + const view = new DataView(buffer); + // Split the number into high and low 32-bit parts + const low = num % Math.pow(2, 32); + const high = Math.floor(num / Math.pow(2, 32)); + view.setUint32(0, low, true); // true for little-endian + view.setUint32(4, high, true); // high part is set after low part + return new Uint8Array(buffer); +} +export function toU256BE(bigIntNumber) { + if (bigIntNumber < BigInt(0) || bigIntNumber > BigInt('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF')) { + throw new Error('Number out of range for U256BE'); + } + const buffer = new ArrayBuffer(32); // 256 bits = 32 bytes + const view = new DataView(buffer); + // Loop through each byte and set it from the start to maintain big-endian order + for (let i = 0; i < 32; i++) { + // Extract each byte of the BigInt number + const byte = Number((bigIntNumber >> BigInt(8 * (31 - i))) & BigInt(0xFF)); + view.setUint8(i, byte); + } + return new Uint8Array(buffer); +} diff --git a/dist/utils/hex.d.ts b/dist/types/utils/hex.d.ts similarity index 100% rename from dist/utils/hex.d.ts rename to dist/types/utils/hex.d.ts diff --git a/dist/types/utils/hex.js b/dist/types/utils/hex.js new file mode 100644 index 00000000..ac8cd93d --- /dev/null +++ b/dist/types/utils/hex.js @@ -0,0 +1,7 @@ +export function isValidHex(hex) { + const isHexStrict = /^(0x)?[0-9a-f]*$/i.test(hex.toString()); + if (!isHexStrict) { + throw new Error(`Given value "${hex}" is not a valid hex string.`); + } + return isHexStrict; +} diff --git a/dist/types/utils/index.d.ts b/dist/types/utils/index.d.ts new file mode 100644 index 00000000..4df02a32 --- /dev/null +++ b/dist/types/utils/index.d.ts @@ -0,0 +1,3 @@ +export * from './address'; +export * from './hex'; +export * from './transaction'; diff --git a/dist/utils/index.js b/dist/types/utils/index.js similarity index 71% rename from dist/utils/index.js rename to dist/types/utils/index.js index d4f50a30..4df02a32 100644 --- a/dist/utils/index.js +++ b/dist/types/utils/index.js @@ -1,4 +1,3 @@ export * from './address'; export * from './hex'; export * from './transaction'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/utils/transaction.d.ts b/dist/types/utils/transaction.d.ts similarity index 100% rename from dist/utils/transaction.d.ts rename to dist/types/utils/transaction.d.ts diff --git a/dist/types/utils/transaction.js b/dist/types/utils/transaction.js new file mode 100644 index 00000000..a8b32689 --- /dev/null +++ b/dist/types/utils/transaction.js @@ -0,0 +1,13 @@ +import { encode } from 'bs58'; +export function solanaTransactionLog(transaction) { + console.log(transaction.instructions.map(({ programId, keys, data }, index) => { + return `[${index}] programId: ${programId.toBase58()} +keys: +${keys.map(k => `${k.pubkey.toBase58()} [${k.isSigner ? 'signer' : ''}${k.isSigner && k.isWritable ? ', ' : ''}${k.isWritable ? 'writer' : ''}]`).join('\n')} +data: +${encode(data)} +0x${Buffer.from(data).toString('hex')} +${JSON.stringify(data)} +------------------------------`; + }).join('\n\n')); +} diff --git a/dist/utils/address.js.map b/dist/utils/address.js.map deleted file mode 100644 index a79364b3..00000000 --- a/dist/utils/address.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"address.js","sourceRoot":"","sources":["../../src/utils/address.ts"],"names":[],"mappings":"A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E/C,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,yBAAyB;IACvD,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,kCAAkC;IAEjE,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,YAAoB;IAC3C,IAAI,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,YAAY,GAAG,MAAM,CAAC,oEAAoE,CAAC,EAAE;QAC3H,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;IAED,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,sBAAsB;IAC1D,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;IAElC,gFAAgF;IAChF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;QAC3B,yCAAyC;QACzC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,YAAY,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3E,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;KACxB;IAED,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"} \ No newline at end of file diff --git a/dist/utils/hex.js.map b/dist/utils/hex.js.map deleted file mode 100644 index d5656fd6..00000000 --- a/dist/utils/hex.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"hex.js","sourceRoot":"","sources":["../../src/utils/hex.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,GAAoB;IAC7C,MAAM,WAAW,GAAG,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7D,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,gBAAgB,GAAG,8BAA8B,CAAC,CAAC;KACpE;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/dist/utils/index.js.map b/dist/utils/index.js.map deleted file mode 100644 index 41b57d2b..00000000 --- a/dist/utils/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC"} \ No newline at end of file diff --git a/dist/utils/transaction.js.map b/dist/utils/transaction.js.map deleted file mode 100644 index 9a6272ee..00000000 --- a/dist/utils/transaction.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,MAAM,UAAU,oBAAoB,CAAC,WAAwB;IAC3D,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE;QAC5E,OAAO,IAAI,KAAK,gBAAgB,SAAS,CAAC,QAAQ,EAAE;;EAEtD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;EAE1J,MAAM,CAAC,IAAI,CAAC;IACV,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC;EACnC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;+BACS,CAAC;IAC9B,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/package.json b/package.json index b8f58260..300ded4e 100644 --- a/package.json +++ b/package.json @@ -1,21 +1,21 @@ { "name": "@neonevm/token-transfer", - "version": "3.0.0", + "version": "3.0.1", "description": "JavaScript client-side module for creating transfer transactions from Solana to NeonEVM", + "main": "./dist/cjs/index.js", + "module": "./dist/esm/index.js", + "types": "./dist/types/index.d.ts", "files": [ "./dist/**/*" ], - "main": "./dist/index.js", - "types": "./dist/index.d.ts", "engines": { - "node": ">=16" + "node": ">=18" }, "scripts": { "start": "yarn test", - "clean": "rm -rf ./dist", - "build": "npm run clean && tsc", - "build:esm": "tsc -p ./tsconfig.esm.json", - "build:cjs": "tsc -p ./tsconfig.cjs.json", + "compile": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json", + "build": "npm-run-all build:clean compile && node ./scripts/prepare-package-json", + "build:clean": "rm -rf ./dist", "prepack": "npm run build", "test": "jest --detectOpenHandles", "test:watch": "jest --watch --detectOpenHandles", @@ -50,6 +50,7 @@ "@types/big.js": "^6.1.6", "@types/crypto-js": "^4.1.1", "@types/jest": "^29.2.3", + "@types/node-fetch": "^2.6.10", "@types/react": "^18.0.25", "@types/react-dom": "^18.0.9", "@typescript-eslint/parser": "^5.43.0", @@ -59,13 +60,14 @@ "eslint": "8.27.0", "eslint-plugin-prettier": "^4.2.1", "jest": "^29.3.1", + "npm-run-all": "^4.1.5", "prettier": "2.7.1", "react": "18", "react-dom": "^18.2.0", "solc": "^0.8.23-fixed", - "token-list": "https://github.com/neonlabsorg/token-list.git#v5.2.1", - "ts-jest": "^29.0.3", - "ts-node": "^10.9.1", - "typescript": "^4.9.3" + "token-list": "https://github.com/neonlabsorg/token-list.git#v5.3.0", + "ts-jest": "^29.1.1", + "ts-node": "^10.9.2", + "typescript": "~5.1.6" } } diff --git a/scripts/prepare-package-json.js b/scripts/prepare-package-json.js new file mode 100644 index 00000000..21a3a4fe --- /dev/null +++ b/scripts/prepare-package-json.js @@ -0,0 +1,26 @@ +const fs = require('fs'); +const path = require('path'); +const buildDir = './dist'; + +function createEsmModulePackageJson() { + fs.readdir(buildDir, function(err, dirs) { + if (err) { + throw err; + } + dirs.forEach(function(dir) { + if (dir === 'esm') { + const packageJsonFile = path.join(buildDir, dir, '/package.json'); + if (!fs.existsSync(packageJsonFile)) { + fs.writeFile(packageJsonFile, new Uint8Array(Buffer.from('{"type": "module"}')), + (err) => { + if (err) { + throw err; + } + }); + } + } + }); + }); +} + +createEsmModulePackageJson(); diff --git a/src/__tests__/e2e/erc20.ts b/src/__tests__/e2e/erc20.ts index 497a4f70..bfc2c50c 100644 --- a/src/__tests__/e2e/erc20.ts +++ b/src/__tests__/e2e/erc20.ts @@ -4,7 +4,7 @@ import { Connection, Keypair, PublicKey, Signer } from '@solana/web3.js'; import Web3 from 'web3'; import { Account } from 'web3-core'; import { - createMintNeonWeb3Transaction, + createMintNeonTransactionWeb3, createMintSolanaTransaction, neonTransferMintWeb3Transaction } from '../../core'; @@ -58,7 +58,7 @@ export async function itNeonTokenMint(connection: Connection, web3: Web3, faucet const associatedToken = getAssociatedTokenAddressSync(mintPubkey, solanaWallet.publicKey); const solanaTransaction = createMintSolanaTransaction(solanaWallet.publicKey, mintPubkey, associatedToken, neonProxyStatus); solanaTransaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash; - const neonTransaction = await createMintNeonWeb3Transaction(web3, neonWallet.address, associatedToken, token, amount); + const neonTransaction = await createMintNeonTransactionWeb3(web3, neonWallet.address, associatedToken, token, amount); const signer: Signer = toSigner(solanaWallet); try { const signedSolanaTransaction = await sendSolanaTransaction(connection, solanaTransaction, [signer], true, { skipPreflight }); diff --git a/src/__tests__/e2e/transfer-sol.spec.ts b/src/__tests__/e2e/transfer-sol.spec.ts index 00b999a9..b10c5d55 100644 --- a/src/__tests__/e2e/transfer-sol.spec.ts +++ b/src/__tests__/e2e/transfer-sol.spec.ts @@ -19,7 +19,7 @@ import { solanaSignature, splTokenBalance, toSigner } from '../tools'; -import { neonNeonWeb3Transaction, solanaSOLTransferTransaction } from '../../core'; +import { neonNeonTransactionWeb3, solanaSOLTransferTransaction } from '../../core'; import { NeonProxyRpcApi } from '../../api'; import { SOL_TRANSFER_CONTRACT_DEVNET } from '../../data'; import { itNeonTokenMint, itSolanaTokenSPL } from './erc20'; @@ -93,7 +93,7 @@ describe(`SOL Transfer tests`, () => { const solToken: SPLToken = { ...faucet.tokens[id], ...SOL_TOKEN_MODEL, chainId }; try { const balanceBefore = await neonBalance(web3, neonWallet.address); - const transaction = await neonNeonWeb3Transaction(web3, neonWallet.address, SOL_TRANSFER_CONTRACT_DEVNET, solanaWallet.publicKey, amount); + const transaction = await neonNeonTransactionWeb3(web3, neonWallet.address, SOL_TRANSFER_CONTRACT_DEVNET, solanaWallet.publicKey, amount); const hash = await sendNeonTransaction(web3, transaction, neonWallet); neonSignature(`NeonEvm (SOL) signature`, hash); expect(hash.length).toBeGreaterThan(2); diff --git a/src/__tests__/e2e/transfers.spec.ts b/src/__tests__/e2e/transfers.spec.ts index 70d1b8ec..996b78ff 100644 --- a/src/__tests__/e2e/transfers.spec.ts +++ b/src/__tests__/e2e/transfers.spec.ts @@ -6,14 +6,14 @@ import { Account } from 'web3-core'; import { AbiItem } from 'web3-utils'; import { NeonProxyRpcApi } from '../../api'; import { - createMintNeonWeb3Transaction, + createMintNeonTransactionWeb3, createMintSolanaTransaction, createUnwrapSOLTransaction, createWrapAndTransferSOLTransactionWeb3, - neonNeonWeb3Transaction, + neonNeonTransactionWeb3, solanaNEONTransferTransaction, wrappedNeonTransaction, - wrappedNeonTransactionData + wrappedNeonTransactionDataWeb3 } from '../../core'; import { GasToken, NeonProgramStatus, SPLToken } from '../../models'; import { @@ -144,7 +144,7 @@ describe('NEON token transfer tests', () => { }; try { const balanceBefore = await neonBalance(web3, neonWallet.address); - const transaction = await neonNeonWeb3Transaction(web3, neonWallet.address, NEON_TRANSFER_CONTRACT_DEVNET, solanaWallet.publicKey, amount); + const transaction = await neonNeonTransactionWeb3(web3, neonWallet.address, NEON_TRANSFER_CONTRACT_DEVNET, solanaWallet.publicKey, amount); const hash = await sendNeonTransaction(web3, transaction, neonWallet); neonSignature(`Signature`, hash); expect(hash.length).toBeGreaterThan(2); @@ -195,7 +195,7 @@ describe('NEON token transfer tests', () => { const neonBalanceBefore = await neonBalance(web3, neonWallet.address); const wneonBalanceBefore = await mintTokenBalance(web3, neonWallet.address, wneon, neonWrapper2Abi as AbiItem[]); try { - const wrapTransaction = await neonNeonWeb3Transaction(web3, neonWallet.address, wneon.address, solanaWallet.publicKey, amount); + const wrapTransaction = await neonNeonTransactionWeb3(web3, neonWallet.address, wneon.address, solanaWallet.publicKey, amount); const wrapHash = await sendNeonTransaction(web3, wrapTransaction, neonWallet); neonSignature(`NEON wrap signature`, wrapHash); expect(wrapHash.length).toBeGreaterThan(2); @@ -223,7 +223,7 @@ describe('NEON token transfer tests', () => { const wneon: SPLToken = faucet.tokens[id]; const wneonBalanceBefore = await mintTokenBalance(web3, neonWallet.address, wneon, neonWrapper2Abi as AbiItem[]); try { - const data = wrappedNeonTransactionData(web3, wneon, amount); + const data = wrappedNeonTransactionDataWeb3(web3, wneon, amount); const unwrapTransaction = wrappedNeonTransaction(neonWallet.address, wneon.address, data); unwrapTransaction.gasPrice = await web3.eth.getGasPrice(); unwrapTransaction.gas = await web3.eth.estimateGas(unwrapTransaction); @@ -237,7 +237,7 @@ describe('NEON token transfer tests', () => { expect(wneonBalanceAfter).toBeLessThan(wneonBalanceBefore); const neonBalanceBefore = await neonBalance(web3, neonWallet.address); - const transaction = await neonNeonWeb3Transaction(web3, neonWallet.address, neon.address, solanaWallet.publicKey, amount); + const transaction = await neonNeonTransactionWeb3(web3, neonWallet.address, neon.address, solanaWallet.publicKey, amount); const hash = await sendNeonTransaction(web3, transaction, neonWallet); neonSignature(`NEON transfer signature`, hash); await delay(5e3); @@ -297,7 +297,7 @@ describe('NEON token transfer tests', () => { console.log(`Balance: ${balanceBefore ?? 0} ${wSOL.symbol}`); const solanaTransaction = createMintSolanaTransaction(solanaWallet.publicKey, mintPubkey, associatedToken, neonProxyStatus); solanaTransaction.recentBlockhash = (await connection.getLatestBlockhash()).blockhash; - const neonTransaction = await createMintNeonWeb3Transaction(web3, neonWallet.address, associatedToken, wSOL, amount); + const neonTransaction = await createMintNeonTransactionWeb3(web3, neonWallet.address, associatedToken, wSOL, amount); const wSolBefore = await connection.getBalance(associatedToken); console.log(`Balance: ${wSolBefore / LAMPORTS_PER_SOL} ${wSOL.symbol}`); try { diff --git a/src/core/deprecated/MintPortal.ts b/src/core/deprecated/MintPortal.ts index 7df9ed25..190539ac 100644 --- a/src/core/deprecated/MintPortal.ts +++ b/src/core/deprecated/MintPortal.ts @@ -7,12 +7,12 @@ import { Account, SignedTransaction, TransactionConfig } from 'web3-core'; import { toFullAmount } from '../../utils'; import { Amount, SPLToken } from '../../models'; import { - climeTransactionData, + climeTransactionDataWeb3, createClaimInstruction, createComputeBudgetHeapFrameInstruction, createComputeBudgetUtilsInstruction, createExecFromDataInstruction, - createMintNeonWeb3Transaction, + createMintNeonTransactionWeb3, createMintSolanaTransaction, createUnwrapSOLTransaction, createWrapSOLTransaction, @@ -65,14 +65,13 @@ export class MintPortal extends InstructionService { const fullAmount = toFullAmount(amount, splToken.decimals); const walletSigner = await solanaWalletSigner(this.web3, this.solanaWalletPubkey, this.neonWalletAddress); const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), this.solanaWalletPubkey); - const climeData = climeTransactionData(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); + const climeData = climeTransactionDataWeb3(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); const signedTransaction = await neonClaimTransactionFromSigner(climeData, walletSigner, this.neonWalletAddress, splToken); const { neonKeys, - neonTransaction, legacyAccounts } = await createClaimInstruction(this.proxyApi, signedTransaction); - const transaction = await neonTransferMintTransaction(this.connection, this.proxyStatus, this.programId, this.solanaWalletPubkey, this.neonWalletAddress, walletSigner, neonKeys, legacyAccounts, neonTransaction, splToken, fullAmount, 111); + const transaction = await neonTransferMintTransaction(this.connection, this.proxyStatus, this.programId, this.solanaWalletPubkey, this.neonWalletAddress, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, 111); transaction.recentBlockhash = (await this.connection.getLatestBlockhash()).blockhash; return transaction; } @@ -89,14 +88,14 @@ export class MintPortal extends InstructionService { const nonce = await this.web3.eth.getTransactionCount(emulateSigner.address); const fullAmount = toFullAmount(amount, splToken.decimals); const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), this.solanaWalletAddress); - const climeData = climeTransactionData(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); + const climeData = climeTransactionDataWeb3(this.web3, associatedTokenAddress, this.neonWalletAddress, fullAmount); const walletSigner = await solanaWalletSigner(this.web3, this.solanaWalletAddress, this.neonWalletAddress); const signedTransaction = await neonClaimTransactionFromSigner(climeData, walletSigner, this.neonWalletAddress, splToken); const { neonKeys, neonTransaction } = await createClaimInstruction(this.proxyApi, signedTransaction); - return { neonKeys, neonTransaction, emulateSigner, nonce }; + return { neonKeys, neonTransaction: signedTransaction, emulateSigner, nonce }; } makeTrExecFromDataIx(neonAddress: PublicKey, neonRawTransaction: string, neonKeys: AccountMeta[]): TransactionInstruction { @@ -108,7 +107,7 @@ export class MintPortal extends InstructionService { } async createNeonTransaction(neonWallet: string, solanaWallet: PublicKey, splToken: SPLToken, amount: Amount): Promise { - return createMintNeonWeb3Transaction(this.web3, neonWallet, solanaWallet, splToken, amount); + return createMintNeonTransactionWeb3(this.web3, neonWallet, solanaWallet, splToken, amount); } async solanaTransferTransaction(walletPubkey: PublicKey, mintPubkey: PublicKey, associatedTokenPubkey: PublicKey): Promise { diff --git a/src/core/deprecated/NeonPortal.ts b/src/core/deprecated/NeonPortal.ts index ace324ac..47dccbc8 100644 --- a/src/core/deprecated/NeonPortal.ts +++ b/src/core/deprecated/NeonPortal.ts @@ -5,7 +5,7 @@ import { Amount, SPLToken } from '../../models'; import { createNeonDepositInstruction, createNeonTransferInstruction, - neonTransactionData, + neonTransactionDataWeb3, solanaNEONTransferTransaction } from '../neon-transfer'; import { authorityPoolAddress } from '../utils'; @@ -63,7 +63,7 @@ export class NeonPortal extends InstructionService { } createWithdrawEthTransactionData(): string { - return neonTransactionData(this.web3, this.solanaWalletPubkey); + return neonTransactionDataWeb3(this.web3, this.solanaWalletPubkey); } ethereumTransaction(amount: Amount, token: SPLToken): TransactionConfig { diff --git a/src/core/mint-transfer.ts b/src/core/mint-transfer.ts index 60a980b7..6d6d5ff5 100644 --- a/src/core/mint-transfer.ts +++ b/src/core/mint-transfer.ts @@ -38,7 +38,7 @@ import { NeonProxyRpcApi } from '../api'; import { authAccountAddress, collateralPoolAddress, - erc20ForSPLContract, + erc20ForSPLContractWeb3, neonBalanceProgramAddress, neonWalletProgramAddress, solanaWalletSigner @@ -47,15 +47,11 @@ import { export async function neonTransferMintWeb3Transaction(connection: Connection, web3: Web3, proxyApi: NeonProxyRpcApi, proxyStatus: NeonProgramStatus, neonEvmProgram: PublicKey, solanaWallet: PublicKey, neonWallet: string, splToken: SPLToken, amount: Amount, chainId: number): Promise { const fullAmount = toFullAmount(amount, splToken.decimals); const associatedTokenAddress = getAssociatedTokenAddressSync(new PublicKey(splToken.address_spl), solanaWallet); - const climeData = climeTransactionData(web3, associatedTokenAddress, neonWallet, fullAmount); + const climeData = climeTransactionDataWeb3(web3, associatedTokenAddress, neonWallet, fullAmount); const walletSigner = solanaWalletSigner(web3, solanaWallet, neonWallet); const signedTransaction = await neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); - const { - neonKeys, - neonTransaction, - legacyAccounts - } = await createClaimInstruction(proxyApi, signedTransaction); - return neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, neonTransaction, splToken, fullAmount, chainId); + const { neonKeys, legacyAccounts } = await createClaimInstruction(proxyApi, signedTransaction); + return neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, chainId); } export async function neonTransferMintTransaction(connection: Connection, proxyStatus: NeonProgramStatus, neonEvmProgram: PublicKey, solanaWallet: PublicKey, neonWallet: string, emulateSigner: Account, neonKeys: AccountMeta[], legacyAccounts: SolanaAccount[], neonTransaction: SignedTransaction, splToken: SPLToken, amount: bigint, chainId: number): Promise { @@ -151,8 +147,8 @@ export function createAccountBalanceInstruction(solanaWallet: PublicKey, neonEvm return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); } -export function climeTransactionData(web3: Web3, associatedToken: PublicKey, neonWallet: string, amount: Amount): string { - const claimTo = erc20ForSPLContract(web3).methods.claimTo(associatedToken.toBuffer(), neonWallet, amount); +export function climeTransactionDataWeb3(web3: Web3, associatedToken: PublicKey, neonWallet: string, amount: Amount): string { + const claimTo = erc20ForSPLContractWeb3(web3).methods.claimTo(associatedToken.toBuffer(), neonWallet, amount); return claimTo.encodeABI(); } @@ -167,43 +163,40 @@ export async function neonClaimTransactionFromSigner(climeData: string, walletSi return walletSigner.signTransaction(transaction); } -export async function createClaimInstruction(proxyApi: NeonProxyRpcApi, neonTransaction: SignedTransaction): Promise { - try { - let neonEmulate: NeonEmulate; - const legacyAccounts: SolanaAccount[] = []; - if (neonTransaction.rawTransaction) { - neonEmulate = await proxyApi.neonEmulate([neonTransaction.rawTransaction.slice(2)]); - } - const accountsMap = new Map(); - if (neonEmulate!) { - const { accounts = [], solana_accounts = [] } = neonEmulate; - for (const account of accounts) { - const key = account['account']; +export function createClaimInstructionKeys(neonEmulate: NeonEmulate): ClaimInstructionResult { + const legacyAccounts: SolanaAccount[] = []; + const accountsMap = new Map(); + if (neonEmulate!) { + const { accounts = [], solana_accounts = [] } = neonEmulate; + for (const account of accounts) { + const key = account['account']; + accountsMap.set(key, { pubkey: new PublicKey(key), isSigner: false, isWritable: true }); + if (account['contract']) { + const key = account['contract']; accountsMap.set(key, { pubkey: new PublicKey(key), isSigner: false, isWritable: true }); - if (account['contract']) { - const key = account['contract']; - accountsMap.set(key, { pubkey: new PublicKey(key), isSigner: false, isWritable: true }); - } } - - for (const account of solana_accounts) { - const { pubkey, is_legacy, is_writable } = account; - accountsMap.set(pubkey, { - pubkey: new PublicKey(pubkey), - isSigner: false, - isWritable: is_writable - }); - if (is_legacy) { - legacyAccounts.push(account); - } + } + for (const account of solana_accounts) { + const { pubkey, is_legacy, is_writable } = account; + accountsMap.set(pubkey, { + pubkey: new PublicKey(pubkey), + isSigner: false, + isWritable: is_writable + }); + if (is_legacy) { + legacyAccounts.push(account); } } - return { neonKeys: Array.from(accountsMap.values()), neonTransaction, legacyAccounts }; - } catch (e) { - console.log(e); } -// @ts-ignore - return { neonKeys: [], neonTransaction: null }; + return { neonKeys: Array.from(accountsMap.values()), legacyAccounts }; +} + +export async function createClaimInstruction(proxyApi: NeonProxyRpcApi, neonTransaction: SignedTransaction): Promise { + if (neonTransaction.rawTransaction) { + const neonEmulate: NeonEmulate = await proxyApi.neonEmulate([neonTransaction.rawTransaction.slice(2)]); + return createClaimInstructionKeys(neonEmulate); + } + return { neonKeys: [], legacyAccounts: [], neonTransaction }; } export function createExecFromDataInstruction(solanaWallet: PublicKey, neonPDAWallet: PublicKey, neonEvmProgram: PublicKey, neonRawTransaction: string, neonKeys: AccountMeta[], proxyStatus: NeonProgramStatus): TransactionInstruction { @@ -246,8 +239,8 @@ export function createExecFromDataInstructionV2(solanaWallet: PublicKey, neonWal return new TransactionInstruction({ programId: neonEvmProgram, keys, data }); } -export async function createMintNeonWeb3Transaction(web3: Web3, neonWallet: string, associatedToken: PublicKey, splToken: SPLToken, amount: Amount, gasLimit = 5e4): Promise { - const data = mintNeonTransactionData(web3, associatedToken, splToken, amount); +export async function createMintNeonTransactionWeb3(web3: Web3, neonWallet: string, associatedToken: PublicKey, splToken: SPLToken, amount: Amount, gasLimit = 5e4): Promise { + const data = mintNeonTransactionDataWeb3(web3, associatedToken, splToken, amount); const transaction = createMintNeonTransaction(neonWallet, splToken, data); transaction.gasPrice = await web3.eth.getGasPrice(); transaction.gas = await web3.eth.estimateGas(transaction); @@ -257,9 +250,9 @@ export async function createMintNeonWeb3Transaction(web3: Web3, neonWallet: stri return transaction; } -export function mintNeonTransactionData(web3: Web3, associatedToken: PublicKey, splToken: SPLToken, amount: Amount): string { +export function mintNeonTransactionDataWeb3(web3: Web3, associatedToken: PublicKey, splToken: SPLToken, amount: Amount): string { const fullAmount = toFullAmount(amount, splToken.decimals); - return erc20ForSPLContract(web3).methods.transferSolana(associatedToken.toBuffer(), fullAmount).encodeABI(); + return erc20ForSPLContractWeb3(web3).methods.transferSolana(associatedToken.toBuffer(), fullAmount).encodeABI(); } export function createMintNeonTransaction(neonWallet: string, splToken: SPLToken, data: string): TransactionConfig { @@ -336,15 +329,11 @@ export async function createWrapAndTransferSOLTransactionWeb3(connection: Connec const fullAmount = toFullAmount(amount, splToken.decimals); const associatedTokenAddress = getAssociatedTokenAddressSync(tokenMint, solanaWallet); const wSOLAccount = await connection.getAccountInfo(associatedTokenAddress); - const climeData = climeTransactionData(web3, associatedTokenAddress, neonWallet, fullAmount); + const climeData = climeTransactionDataWeb3(web3, associatedTokenAddress, neonWallet, fullAmount); const walletSigner = solanaWalletSigner(web3, solanaWallet, neonWallet); const signedTransaction = await neonClaimTransactionFromSigner(climeData, walletSigner, neonWallet, splToken); - const { - neonKeys, - neonTransaction, - legacyAccounts - } = await createClaimInstruction(proxyApi, signedTransaction); - const mintTransaction = await neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, neonTransaction, splToken, fullAmount, chainId); + const { neonKeys, legacyAccounts } = await createClaimInstruction(proxyApi, signedTransaction); + const mintTransaction = await neonTransferMintTransaction(connection, proxyStatus, neonEvmProgram, solanaWallet, neonWallet, walletSigner, neonKeys, legacyAccounts, signedTransaction, splToken, fullAmount, chainId); if (!wSOLAccount) { instructions.push(createAssociatedTokenAccountInstruction(tokenMint, associatedTokenAddress, solanaWallet, solanaWallet)); diff --git a/src/core/neon-transfer.ts b/src/core/neon-transfer.ts index 3207fe46..f8bb9757 100644 --- a/src/core/neon-transfer.ts +++ b/src/core/neon-transfer.ts @@ -16,8 +16,8 @@ import { authorityPoolAddress, neonBalanceProgramAddress, neonWalletProgramAddress, - neonWrapper2Contract, - neonWrapperContract + neonWrapper2ContractWeb3, + neonWrapperContractWeb3 } from './utils'; export async function solanaNEONTransferTransaction(solanaWallet: PublicKey, neonWallet: NeonAddress, neonEvmProgram: PublicKey, neonTokenMint: PublicKey, token: SPLToken, amount: Amount, chainId = 111, serviceWallet?: PublicKey, rewardAmount?: Amount): Promise { @@ -95,13 +95,13 @@ export function createNeonTransferInstruction(neonTokenMint: PublicKey, solanaWa return new TransactionInstruction({ programId: TOKEN_PROGRAM_ID, keys, data }); } -export function neonTransactionData(web3: Web3, solanaWallet: PublicKey): string { - return neonWrapperContract(web3).methods.withdraw(solanaWallet.toBuffer()).encodeABI(); +export function neonTransactionDataWeb3(web3: Web3, solanaWallet: PublicKey): string { + return neonWrapperContractWeb3(web3).methods.withdraw(solanaWallet.toBuffer()).encodeABI(); } -export function wrappedNeonTransactionData(web3: Web3, token: SPLToken, amount: Amount): string { +export function wrappedNeonTransactionDataWeb3(web3: Web3, token: SPLToken, amount: Amount): string { const value = toWei(amount.toString(), 'ether'); - const contract = neonWrapper2Contract(web3, token.address); + const contract = neonWrapper2ContractWeb3(web3, token.address); return contract.methods.withdraw(value).encodeABI(); } @@ -115,8 +115,8 @@ export function neonNeonTransaction(from: string, to: string, amount: Amount, da return { from, to, value, data }; } -export async function neonNeonWeb3Transaction(web3: Web3, from: string, to: string, solanaWallet: PublicKey, amount: Amount, gasLimit = 5e4): Promise { - const data = neonTransactionData(web3, solanaWallet); +export async function neonNeonTransactionWeb3(web3: Web3, from: string, to: string, solanaWallet: PublicKey, amount: Amount, gasLimit = 5e4): Promise { + const data = neonTransactionDataWeb3(web3, solanaWallet); const transaction = neonNeonTransaction(from, to, amount, data); transaction.gasPrice = await web3.eth.getGasPrice(); transaction.gas = await web3.eth.estimateGas(transaction); diff --git a/src/core/utils/contracts.ts b/src/core/utils/contracts.ts index 6d389d26..562948ab 100644 --- a/src/core/utils/contracts.ts +++ b/src/core/utils/contracts.ts @@ -3,14 +3,14 @@ import { AbiItem } from 'web3-utils'; import Web3 from 'web3'; import { erc20Abi, neonWrapper2Abi, neonWrapperAbi } from '../../data'; -export function erc20ForSPLContract(web3: Web3): Contract { +export function erc20ForSPLContractWeb3(web3: Web3): Contract { return new web3.eth.Contract(erc20Abi as AbiItem[]); } -export function neonWrapperContract(web3: Web3): Contract { +export function neonWrapperContractWeb3(web3: Web3): Contract { return new web3.eth.Contract(neonWrapperAbi as AbiItem[]); } -export function neonWrapper2Contract(web3: Web3, address: string): Contract { +export function neonWrapper2ContractWeb3(web3: Web3, address: string): Contract { return new web3.eth.Contract(neonWrapper2Abi as AbiItem[], address); } diff --git a/src/models/api.ts b/src/models/api.ts index 4493d77f..fe90abf1 100644 --- a/src/models/api.ts +++ b/src/models/api.ts @@ -78,7 +78,7 @@ export interface NeonAccounts { } export interface ClaimInstructionResult { - neonTransaction: SignedTransaction; + neonTransaction?: SignedTransaction; neonKeys: AccountMeta[]; legacyAccounts: SolanaAccount[]; } diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json new file mode 100644 index 00000000..44b90283 --- /dev/null +++ b/tsconfig.cjs.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "commonjs", + "outDir": "./dist/cjs" + } +} diff --git a/tsconfig.esm.json b/tsconfig.esm.json new file mode 100644 index 00000000..f99918a1 --- /dev/null +++ b/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "es2020", + "outDir": "./dist/esm" + } +} diff --git a/tsconfig.json b/tsconfig.json index eef438bd..156c7e46 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,18 @@ { "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { - "strict": true, - "noImplicitAny": false, - "noEmitOnError": true, - "removeComments": false, - "sourceMap": true, - "target": "es2020", - "outDir": "dist", + "lib": [ + "es2020", + "dom" + ], + "target": "es2015", + "module": "es2020", "moduleResolution": "node", - "resolveJsonModule": true, - "allowSyntheticDefaultImports": true, - "declaration": true + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true }, "include": [ "src/**/*" diff --git a/tsconfig.types.json b/tsconfig.types.json new file mode 100644 index 00000000..858ec9a5 --- /dev/null +++ b/tsconfig.types.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/types", + "module": "ESNext", + "declaration": true + } +} diff --git a/yarn.lock b/yarn.lock index e9ca8e51..cbff3ca1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -771,11 +771,16 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/resolve-uri@3.1.0", "@jridgewell/resolve-uri@^3.0.3": +"@jridgewell/resolve-uri@3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== +"@jridgewell/resolve-uri@^3.0.3": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== + "@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" @@ -972,9 +977,9 @@ integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== "@tsconfig/node16@^1.0.2": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" - integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" + integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== "@types/babel__core@^7.1.14": version "7.1.20" @@ -1089,6 +1094,14 @@ dependencies: "@types/node" "*" +"@types/node-fetch@^2.6.10": + version "2.6.10" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.10.tgz#ff5c1ceacab782f2b7ce69957d38c1c27b0dc469" + integrity sha512-PPpPK6F9ALFTn59Ka3BaL+qGuipRfxNE8qVgkp0bVixeiR2c2/L+IVOiBdu9JhhT22sWnQEp6YyHGI2b2+CMcA== + dependencies: + "@types/node" "*" + form-data "^4.0.0" + "@types/node@*": version "18.11.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.9.tgz#02d013de7058cea16d36168ef2fc653464cfbad4" @@ -1246,11 +1259,16 @@ acorn-jsx@^5.3.2: integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^8.1.1: - version "8.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" - integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + version "8.3.1" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.1.tgz#2f10f5b69329d90ae18c58bf1fa8fccd8b959a43" + integrity sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw== -acorn@^8.4.1, acorn@^8.8.0: +acorn@^8.4.1: + version "8.11.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" + integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== + +acorn@^8.8.0: version "8.8.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.1.tgz#0a3f9cbecc4ec3bea6f0a80b66ae8dd2da250b73" integrity sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA== @@ -1330,6 +1348,14 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== +array-buffer-byte-length@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead" + integrity sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A== + dependencies: + call-bind "^1.0.2" + is-array-buffer "^3.0.1" + array-flatten@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2" @@ -1340,6 +1366,19 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== +arraybuffer.prototype.slice@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz#98bd561953e3e74bb34938e77647179dfe6e9f12" + integrity sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw== + dependencies: + array-buffer-byte-length "^1.0.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + is-array-buffer "^3.0.2" + is-shared-array-buffer "^1.0.2" + asn1@~0.2.3: version "0.2.6" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" @@ -1703,6 +1742,15 @@ call-bind@^1.0.0, call-bind@^1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" +call-bind@^1.0.4, call-bind@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" + integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ== + dependencies: + function-bind "^1.1.2" + get-intrinsic "^1.2.1" + set-function-length "^1.1.1" + callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -1728,7 +1776,7 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== -chalk@^2.0.0: +chalk@^2.0.0, chalk@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -1839,7 +1887,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -combined-stream@^1.0.6, combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -1960,6 +2008,17 @@ cross-fetch@^3.1.4: dependencies: node-fetch "2.6.7" +cross-spawn@^6.0.5: + version "6.0.5" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== + dependencies: + nice-try "^1.0.4" + path-key "^2.0.1" + semver "^5.5.0" + shebang-command "^1.2.0" + which "^1.2.9" + cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -2047,6 +2106,24 @@ defer-to-connect@^2.0.0, defer-to-connect@^2.0.1: resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== +define-data-property@^1.0.1, define-data-property@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" + integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== + dependencies: + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + +define-properties@^1.1.3, define-properties@^1.2.0, define-properties@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" + integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== + dependencies: + define-data-property "^1.0.1" + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + delay@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/delay/-/delay-5.0.0.tgz#137045ef1b96e5071060dd5be60bf9334436bd1d" @@ -2166,6 +2243,69 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +es-abstract@^1.22.1: + version "1.22.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.3.tgz#48e79f5573198de6dee3589195727f4f74bc4f32" + integrity sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA== + dependencies: + array-buffer-byte-length "^1.0.0" + arraybuffer.prototype.slice "^1.0.2" + available-typed-arrays "^1.0.5" + call-bind "^1.0.5" + es-set-tostringtag "^2.0.1" + es-to-primitive "^1.2.1" + function.prototype.name "^1.1.6" + get-intrinsic "^1.2.2" + get-symbol-description "^1.0.0" + globalthis "^1.0.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + internal-slot "^1.0.5" + is-array-buffer "^3.0.2" + is-callable "^1.2.7" + is-negative-zero "^2.0.2" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + is-string "^1.0.7" + is-typed-array "^1.1.12" + is-weakref "^1.0.2" + object-inspect "^1.13.1" + object-keys "^1.1.1" + object.assign "^4.1.4" + regexp.prototype.flags "^1.5.1" + safe-array-concat "^1.0.1" + safe-regex-test "^1.0.0" + string.prototype.trim "^1.2.8" + string.prototype.trimend "^1.0.7" + string.prototype.trimstart "^1.0.7" + typed-array-buffer "^1.0.0" + typed-array-byte-length "^1.0.0" + typed-array-byte-offset "^1.0.0" + typed-array-length "^1.0.4" + unbox-primitive "^1.0.2" + which-typed-array "^1.1.13" + +es-set-tostringtag@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz#11f7cc9f63376930a5f20be4915834f4bc74f9c9" + integrity sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q== + dependencies: + get-intrinsic "^1.2.2" + has-tostringtag "^1.0.0" + hasown "^2.0.0" + +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + es5-ext@^0.10.35, es5-ext@^0.10.50: version "0.10.62" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.62.tgz#5e6adc19a6da524bf3d1e02bbc8960e5eb49a9a5" @@ -2671,6 +2811,15 @@ form-data-encoder@1.7.1: resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz#ac80660e4f87ee0d3d3c3638b7da8278ddb8ec96" integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -2721,6 +2870,26 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +function.prototype.name@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" + integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + functions-have-names "^1.2.3" + +functions-have-names@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== + gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" @@ -2740,6 +2909,16 @@ get-intrinsic@^1.0.2, get-intrinsic@^1.1.3: has "^1.0.3" has-symbols "^1.0.3" +get-intrinsic@^1.1.1, get-intrinsic@^1.2.0, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" + integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== + dependencies: + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + get-package-type@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" @@ -2757,6 +2936,14 @@ get-stream@^6.0.0, get-stream@^6.0.1: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== +get-symbol-description@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" + integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.1" + getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" @@ -2810,6 +2997,13 @@ globals@^13.15.0: dependencies: type-fest "^0.20.2" +globalthis@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" + integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== + dependencies: + define-properties "^1.1.3" + globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" @@ -2888,6 +3082,11 @@ har-validator@~5.1.3: ajv "^6.12.3" har-schema "^2.0.0" +has-bigints@^1.0.1, has-bigints@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" + integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -2898,6 +3097,18 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-property-descriptors@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" + integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== + dependencies: + get-intrinsic "^1.2.2" + +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== + has-symbols@^1.0.2, has-symbols@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" @@ -2934,6 +3145,13 @@ hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: inherits "^2.0.3" minimalistic-assert "^1.0.1" +hasown@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" + integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== + dependencies: + function-bind "^1.1.2" + hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -2943,6 +3161,11 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" +hosted-git-info@^2.1.4: + version "2.8.9" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" @@ -3064,6 +3287,15 @@ inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +internal-slot@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.6.tgz#37e756098c4911c5e912b8edbf71ed3aa116f930" + integrity sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg== + dependencies: + get-intrinsic "^1.2.2" + hasown "^2.0.0" + side-channel "^1.0.4" + ipaddr.js@1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" @@ -3077,16 +3309,47 @@ is-arguments@^1.0.4: call-bind "^1.0.2" has-tostringtag "^1.0.0" +is-array-buffer@^3.0.1, is-array-buffer@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz#f2653ced8412081638ecb0ebbd0c41c6e0aecbbe" + integrity sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.0" + is-typed-array "^1.1.10" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== -is-callable@^1.1.3: +is-bigint@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" + integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== + dependencies: + has-bigints "^1.0.1" + +is-boolean-object@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + +is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: version "1.2.7" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== +is-core-module@^2.13.0: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + dependencies: + hasown "^2.0.0" + is-core-module@^2.9.0: version "2.11.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" @@ -3094,6 +3357,13 @@ is-core-module@^2.9.0: dependencies: has "^1.0.3" +is-date-object@^1.0.1: + version "1.0.5" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" + integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== + dependencies: + has-tostringtag "^1.0.0" + is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -3133,6 +3403,18 @@ is-hex-prefixed@1.0.0: resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" integrity sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA== +is-negative-zero@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" + integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== + +is-number-object@^1.0.4: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.7.tgz#59d50ada4c45251784e9904f5246c742f07a42fc" + integrity sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ== + dependencies: + has-tostringtag "^1.0.0" + is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" @@ -3143,11 +3425,40 @@ is-path-inside@^3.0.3: resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== +is-regex@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + +is-shared-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" + integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== + dependencies: + call-bind "^1.0.2" + is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== +is-string@^1.0.5, is-string@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== + dependencies: + has-tostringtag "^1.0.0" + +is-symbol@^1.0.2, is-symbol@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" + integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== + dependencies: + has-symbols "^1.0.2" + is-typed-array@^1.1.10, is-typed-array@^1.1.3: version "1.1.10" resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.10.tgz#36a5b5cb4189b575d1a3e4b08536bfb485801e3f" @@ -3159,11 +3470,30 @@ is-typed-array@^1.1.10, is-typed-array@^1.1.3: gopd "^1.0.1" has-tostringtag "^1.0.0" +is-typed-array@^1.1.12, is-typed-array@^1.1.9: + version "1.1.12" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" + integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== + dependencies: + which-typed-array "^1.1.11" + is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== +is-weakref@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" + integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== + dependencies: + call-bind "^1.0.2" + +isarray@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -3669,6 +3999,11 @@ json-buffer@3.0.1: resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== +json-parse-better-errors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== + json-parse-even-better-errors@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" @@ -3699,6 +4034,11 @@ json5@^2.2.1: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== +json5@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -3760,6 +4100,16 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== +load-json-file@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" + integrity sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw== + dependencies: + graceful-fs "^4.1.2" + parse-json "^4.0.0" + pify "^3.0.0" + strip-bom "^3.0.0" + locate-path@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" @@ -4054,6 +4404,11 @@ next-tick@^1.1.0: resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== +nice-try@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== + node-addon-api@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" @@ -4088,6 +4443,16 @@ node-releases@^2.0.6: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.6.tgz#8a7088c63a55e493845683ebf3c828d8c51c5503" integrity sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg== +normalize-package-data@^2.3.2: + version "2.5.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + normalize-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" @@ -4098,6 +4463,21 @@ normalize-url@^6.0.1: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== +npm-run-all@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/npm-run-all/-/npm-run-all-4.1.5.tgz#04476202a15ee0e2e214080861bff12a51d98fba" + integrity sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ== + dependencies: + ansi-styles "^3.2.1" + chalk "^2.4.1" + cross-spawn "^6.0.5" + memorystream "^0.3.1" + minimatch "^3.0.4" + pidtree "^0.3.0" + read-pkg "^3.0.0" + shell-quote "^1.6.1" + string.prototype.padend "^3.0.0" + npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" @@ -4123,11 +4503,31 @@ object-assign@^4, object-assign@^4.1.0, object-assign@^4.1.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== +object-inspect@^1.13.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" + integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + object-inspect@^1.9.0: version "1.12.2" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== +object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object.assign@^4.1.4: + version "4.1.5" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.5.tgz#3a833f9ab7fdb80fc9e8d2300c803d216d8fdbb0" + integrity sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ== + dependencies: + call-bind "^1.0.5" + define-properties "^1.2.1" + has-symbols "^1.0.3" + object-keys "^1.1.1" + oboe@2.1.5: version "2.1.5" resolved "https://registry.yarnpkg.com/oboe/-/oboe-2.1.5.tgz#5554284c543a2266d7a38f17e073821fbde393cd" @@ -4228,6 +4628,14 @@ parse-headers@^2.0.0: resolved "https://registry.yarnpkg.com/parse-headers/-/parse-headers-2.0.5.tgz#069793f9356a54008571eb7f9761153e6c770da9" integrity sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA== +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + integrity sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw== + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + parse-json@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" @@ -4253,6 +4661,11 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== +path-key@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== + path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -4268,6 +4681,13 @@ path-to-regexp@0.1.7: resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" integrity sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ== +path-type@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" + integrity sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg== + dependencies: + pify "^3.0.0" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" @@ -4299,6 +4719,16 @@ picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +pidtree@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.3.1.tgz#ef09ac2cc0533df1f3250ccf2c4d366b0d12114a" + integrity sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA== + +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + integrity sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg== + pirates@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" @@ -4454,6 +4884,15 @@ react@18: dependencies: loose-envify "^1.1.0" +read-pkg@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" + integrity sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA== + dependencies: + load-json-file "^4.0.0" + normalize-package-data "^2.3.2" + path-type "^3.0.0" + readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" @@ -4468,6 +4907,15 @@ regenerator-runtime@^0.13.10: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== +regexp.prototype.flags@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz#90ce989138db209f81492edd734183ce99f9677e" + integrity sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + set-function-name "^2.0.0" + regexpp@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" @@ -4531,6 +4979,15 @@ resolve.exports@^1.1.0: resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== +resolve@^1.10.0: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + resolve@^1.20.0: version "1.22.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" @@ -4607,6 +5064,16 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +safe-array-concat@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.0.1.tgz#91686a63ce3adbea14d61b14c99572a8ff84754c" + integrity sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + has-symbols "^1.0.3" + isarray "^2.0.5" + safe-buffer@5.2.1, safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -4617,6 +5084,15 @@ safe-buffer@~5.1.0: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-regex-test@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" + integrity sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.3" + is-regex "^1.1.4" + "safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -4643,14 +5119,7 @@ secp256k1@^4.0.1: node-addon-api "^2.0.0" node-gyp-build "^4.2.0" -semver@7.x, semver@^7.3.5, semver@^7.3.7: - version "7.3.8" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" - integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== - dependencies: - lru-cache "^6.0.0" - -semver@^5.5.0: +"semver@2 || 3 || 4 || 5", semver@^5.5.0: version "5.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== @@ -4660,6 +5129,20 @@ semver@^6.0.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^7.3.5, semver@^7.3.7: + version "7.3.8" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" + integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== + dependencies: + lru-cache "^6.0.0" + +semver@^7.5.3: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + send@0.18.0: version "0.18.0" resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be" @@ -4700,6 +5183,25 @@ servify@^0.1.12: request "^2.79.0" xhr "^2.3.3" +set-function-length@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed" + integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ== + dependencies: + define-data-property "^1.1.1" + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + +set-function-name@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.1.tgz#12ce38b7954310b9f61faa12701620a0c882793a" + integrity sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA== + dependencies: + define-data-property "^1.0.1" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.0" + setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" @@ -4718,6 +5220,13 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg== + dependencies: + shebang-regex "^1.0.0" + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -4725,11 +5234,21 @@ shebang-command@^2.0.0: dependencies: shebang-regex "^3.0.0" +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== + shebang-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shell-quote@^1.6.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.8.1.tgz#6dbf4db75515ad5bac63b4f1894c3a154c766680" + integrity sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA== + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" @@ -4794,6 +5313,32 @@ source-map@^0.6.0, source-map@^0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +spdx-correct@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" + integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz#3f28ce1a77a00372683eade4a433183527a2163d" + integrity sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A== + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz#cf70f50482eefdc98e3ce0a6833e4a53ceeba679" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.16" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.16.tgz#a14f64e0954f6e25cc6587bd4f392522db0d998f" + integrity sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -4848,6 +5393,42 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string.prototype.padend@^3.0.0: + version "3.1.5" + resolved "https://registry.yarnpkg.com/string.prototype.padend/-/string.prototype.padend-3.1.5.tgz#311ef3a4e3c557dd999cdf88fbdde223f2ac0f95" + integrity sha512-DOB27b/2UTTD+4myKUFh+/fXWcu/UDyASIXfg+7VzoCNNGOfWvoyU/x5pvVHr++ztyt/oSYI1BcWBBG/hmlNjA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + +string.prototype.trim@^1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd" + integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + +string.prototype.trimend@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz#1bb3afc5008661d73e2dc015cd4853732d6c471e" + integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + +string.prototype.trimstart@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298" + integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -4862,6 +5443,11 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== + strip-bom@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" @@ -5003,9 +5589,9 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -"token-list@https://github.com/neonlabsorg/token-list.git#v5.2.1": +"token-list@https://github.com/neonlabsorg/token-list.git#v5.3.0": version "0.0.0" - resolved "https://github.com/neonlabsorg/token-list.git#034c3463ba1bf18b940c4ce3d54513b9eda45d54" + resolved "https://github.com/neonlabsorg/token-list.git#68c8926a67121142b726158e7ba61c565892552e" tough-cookie@~2.5.0: version "2.5.0" @@ -5020,24 +5606,24 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== -ts-jest@^29.0.3: - version "29.0.3" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.0.3.tgz#63ea93c5401ab73595440733cefdba31fcf9cb77" - integrity sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ== +ts-jest@^29.1.1: + version "29.1.1" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.1.tgz#f58fe62c63caf7bfcc5cc6472082f79180f0815b" + integrity sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA== dependencies: bs-logger "0.x" fast-json-stable-stringify "2.x" jest-util "^29.0.0" - json5 "^2.2.1" + json5 "^2.2.3" lodash.memoize "4.x" make-error "1.x" - semver "7.x" + semver "^7.5.3" yargs-parser "^21.0.1" -ts-node@^10.9.1: - version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" - integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== +ts-node@^10.9.2: + version "10.9.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f" + integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ== dependencies: "@cspotcode/source-map-support" "^0.8.0" "@tsconfig/node10" "^1.0.7" @@ -5117,6 +5703,45 @@ type@^2.7.2: resolved "https://registry.yarnpkg.com/type/-/type-2.7.2.tgz#2376a15a3a28b1efa0f5350dcf72d24df6ef98d0" integrity sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw== +typed-array-buffer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz#18de3e7ed7974b0a729d3feecb94338d1472cd60" + integrity sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + is-typed-array "^1.1.10" + +typed-array-byte-length@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz#d787a24a995711611fb2b87a4052799517b230d0" + integrity sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA== + dependencies: + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" + +typed-array-byte-offset@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz#cbbe89b51fdef9cd6aaf07ad4707340abbc4ea0b" + integrity sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" + +typed-array-length@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" + integrity sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng== + dependencies: + call-bind "^1.0.2" + for-each "^0.3.3" + is-typed-array "^1.1.9" + typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" @@ -5124,16 +5749,26 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@^4.9.3: - version "4.9.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.3.tgz#3aea307c1746b8c384435d8ac36b8a2e580d85db" - integrity sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA== +typescript@~5.1.6: + version "5.1.6" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" + integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== ultron@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" integrity sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og== +unbox-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" + integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== + dependencies: + call-bind "^1.0.2" + has-bigints "^1.0.2" + has-symbols "^1.0.3" + which-boxed-primitive "^1.0.2" + universalify@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" @@ -5226,6 +5861,14 @@ v8-to-istanbul@^9.0.1: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^1.6.0" +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + varint@^5.0.0: version "5.0.2" resolved "https://registry.yarnpkg.com/varint/-/varint-5.0.2.tgz#5b47f8a947eb668b848e034dcfa87d0ff8a7f7a4" @@ -5506,6 +6149,28 @@ whatwg-url@^5.0.0: tr46 "~0.0.3" webidl-conversions "^3.0.0" +which-boxed-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + dependencies: + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" + +which-typed-array@^1.1.11, which-typed-array@^1.1.13: + version "1.1.13" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.13.tgz#870cd5be06ddb616f504e7b039c4c24898184d36" + integrity sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.4" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" + which-typed-array@^1.1.2: version "1.1.9" resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.9.tgz#307cf898025848cf995e795e8423c7f337efbde6" @@ -5518,6 +6183,13 @@ which-typed-array@^1.1.2: has-tostringtag "^1.0.0" is-typed-array "^1.1.10" +which@^1.2.9: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== + dependencies: + isexe "^2.0.0" + which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"