@near-eth/aurora-erc20
Advanced tools
Comparing version 2.0.0 to 2.0.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const utils_1 = require("@near-eth/client/dist/utils"); | ||
const serialize_1 = require("near-api-js/lib/utils/serialize"); | ||
const utils_2 = require("@near-eth/utils"); | ||
/** | ||
@@ -23,25 +23,6 @@ * Given an erc20 contract address, get the NEAR contract address of the | ||
const nep141Address = erc20Address.replace('0x', '').toLowerCase() + '.' + nep141Factory; | ||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class | ||
class BorshArgs { | ||
constructor(args) { | ||
Object.assign(this, args); | ||
} | ||
} | ||
; | ||
const schema = new Map([ | ||
[BorshArgs, { | ||
kind: 'struct', | ||
fields: [ | ||
['nep141', 'String'] | ||
] | ||
}] | ||
]); | ||
const args = new BorshArgs({ | ||
nep141: nep141Address | ||
}); | ||
const serializedArgs = serialize_1.serialize(schema, args); | ||
const address = await nearAccount.viewFunction(auroraEvmAccount, 'get_erc20_from_nep141', Buffer.from(serializedArgs), { parse: (result) => Buffer.from(result).toString('hex') }); | ||
return '0x' + address; | ||
const address = await utils_2.aurora.getErc20FromNep141({ nep141Address, nearAccount, auroraEvmAccount }); | ||
return address; | ||
} | ||
exports.default = getAuroraErc20Address; | ||
//# sourceMappingURL=getAddress.js.map |
@@ -245,6 +245,6 @@ "use strict"; | ||
const erc20Address = '0x' + Buffer.from(burnEvent.token).toString('hex'); | ||
const destinationTokenName = await getMetadata_1.getSymbol({ erc20Address, options }); | ||
const symbol = await getMetadata_1.getSymbol({ erc20Address, options }); | ||
const decimals = await getMetadata_1.getDecimals({ erc20Address, options }); | ||
const sourceTokenName = 'a' + destinationTokenName; | ||
const symbol = destinationTokenName; | ||
const sourceTokenName = 'a' + symbol; | ||
const destinationTokenName = symbol; | ||
const sourceToken = 'TODO get aurora address'; | ||
@@ -378,2 +378,3 @@ // @ts-expect-error TODO | ||
console.log('Wrong eth network for checkLock, expected: %s, got: %s', expectedChainId, ethChainId); | ||
return transfer; | ||
} | ||
@@ -384,4 +385,2 @@ // Ethers formats the receipts and removes nearTransactionHash | ||
if (!burnReceipt) { | ||
return transfer; // TODO remove when speed up available on Aurora | ||
// eslint-disable-next-line no-unreachable | ||
if (!transfer.ethCache) | ||
@@ -391,27 +390,7 @@ return transfer; | ||
const tx = { | ||
// @ts-expect-error | ||
nonce: transfer.ethCache.nonce, | ||
// @ts-expect-error | ||
from: transfer.ethCache.from, | ||
// TODO check data is valid when Aurora rpc is complete and contains tx.data (currently "0x") | ||
// @ts-expect-error | ||
data: transfer.ethCache.data, | ||
// @ts-expect-error | ||
to: transfer.ethCache.to | ||
}; | ||
/* | ||
const event = { | ||
name: 'Transfer', // TODO | ||
abi: process.env.auroraErc20AbiText, | ||
address: transfer.sourceToken, | ||
validate: ({ returnValues: { from, to, value } }) => { | ||
return ( | ||
from.toLowerCase() === transfer.sender.toLowerCase() && | ||
to === 0 && // TODO address(0) | ||
value === transfer.amount | ||
) | ||
} | ||
} | ||
*/ | ||
// @ts-expect-error | ||
const foundTx = await find_replacement_tx_1.findReplacementTx(provider, transfer.ethCache.safeReorgHeight, tx); | ||
@@ -421,3 +400,2 @@ if (!foundTx) | ||
// Ethers formats the receipts and removes nearTransactionHash | ||
// @ts-expect-error | ||
burnReceipt = await provider.send('eth_getTransactionReceipt', [foundTx.hash]); | ||
@@ -424,0 +402,0 @@ } |
@@ -168,6 +168,6 @@ "use strict"; | ||
} | ||
const sourceTokenName = await getMetadata_1.getSymbol({ erc20Address, options: { provider } }); | ||
const symbol = await getMetadata_1.getSymbol({ erc20Address, options: { provider } }); | ||
const decimals = await getMetadata_1.getDecimals({ erc20Address, options: { provider } }); | ||
const destinationTokenName = 'a' + sourceTokenName; | ||
const symbol = sourceTokenName; | ||
const destinationTokenName = 'a' + symbol; | ||
const sourceTokenName = symbol; | ||
const txBlock = await lockedEvent.getBlock(); | ||
@@ -494,3 +494,3 @@ const transfer = { | ||
proof = await utils_2.findEthProof('Locked', lockReceipt.transactionHash, (_e = options.erc20LockerAddress) !== null && _e !== void 0 ? _e : bridgeParams.erc20LockerAddress, (_f = options.erc20LockerAbi) !== null && _f !== void 0 ? _f : bridgeParams.erc20LockerAbi, provider); | ||
const proofAlreadyUsed = await nearAccount.viewFunction((_g = options.nep141Factory) !== null && _g !== void 0 ? _g : bridgeParams.nep141Factory, 'is_used_proof', Buffer.from(proof)); | ||
const proofAlreadyUsed = await nearAccount.viewFunction((_g = options.nep141Factory) !== null && _g !== void 0 ? _g : bridgeParams.nep141Factory, 'is_used_proof', Buffer.from(proof), { stringify: (args) => args }); | ||
if (proofAlreadyUsed) { | ||
@@ -497,0 +497,0 @@ // TODO: find the event relayer tx hash |
{ | ||
"name": "@near-eth/aurora-erc20", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"license": "(MIT AND Apache-2.0)", | ||
@@ -23,10 +23,10 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@near-eth/client": "1.6.0", | ||
"@near-eth/utils": "2.0.0", | ||
"@near-eth/client": "1.7.0", | ||
"@near-eth/utils": "2.1.0", | ||
"bn.js": "^5.1.3", | ||
"bs58": "^4.0.1", | ||
"ethereumjs-util": "^7.0.10", | ||
"ethers": "^5.4.0", | ||
"find-replacement-tx": "1.2.0", | ||
"near-api-js": "https://github.com/aurora-is-near/near-api-js#b31f9975b29c69e65c6db2feca2183fac400109e", | ||
"ethers": "^5.4.6", | ||
"find-replacement-tx": "1.2.1", | ||
"near-api-js": "https://github.com/aurora-is-near/near-api-js#2a63db0016a59d031b58033f3ee50942dab4f5f7", | ||
"promisfy": "^1.2.0", | ||
@@ -33,0 +33,0 @@ "rlp": "^2.2.6" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
139705
1851
+ Added@near-eth/client@1.7.0(transitive)
+ Added@near-eth/utils@2.1.0(transitive)
+ Addedfind-replacement-tx@1.2.1(transitive)
- Removed@near-eth/client@1.6.0(transitive)
- Removed@near-eth/utils@2.0.0(transitive)
- Removedfind-replacement-tx@1.2.0(transitive)
Updated@near-eth/client@1.7.0
Updated@near-eth/utils@2.1.0
Updatedethers@^5.4.6
Updatedfind-replacement-tx@1.2.1
Updatednear-api-js@https://github.com/aurora-is-near/near-api-js#2a63db0016a59d031b58033f3ee50942dab4f5f7