Socket
Socket
Sign inDemoInstall

@eth-optimism/sdk

Package Overview
Dependencies
Maintainers
2
Versions
498
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eth-optimism/sdk - npm Package Compare versions

Comparing version 0.0.0-main-20240611023711 to 0.0.0-main-20240612131557

dist/adapters/dai-bridge.js.map

7

dist/adapters/dai-bridge.js

@@ -6,3 +6,3 @@ "use strict";

const ethers_1 = require("ethers");
const utils_1 = require("../utils");
const coercion_1 = require("../utils/coercion");
const standard_bridge_1 = require("./standard-bridge");

@@ -40,7 +40,7 @@ class DAIBridgeAdapter extends standard_bridge_1.StandardBridgeAdapter {

const allowedL1Token = await l1Bridge.l1Token();
if (!(0, core_utils_1.hexStringEquals)(allowedL1Token, (0, utils_1.toAddress)(l1Token))) {
if (!(0, core_utils_1.hexStringEquals)(allowedL1Token, (0, coercion_1.toAddress)(l1Token))) {
return false;
}
const allowedL2Token = await l1Bridge.l2Token();
if (!(0, core_utils_1.hexStringEquals)(allowedL2Token, (0, utils_1.toAddress)(l2Token))) {
if (!(0, core_utils_1.hexStringEquals)(allowedL2Token, (0, coercion_1.toAddress)(l2Token))) {
return false;

@@ -52,1 +52,2 @@ }

exports.DAIBridgeAdapter = DAIBridgeAdapter;
//# sourceMappingURL=dai-bridge.js.map

@@ -6,3 +6,3 @@ "use strict";

const ethers_1 = require("ethers");
const utils_1 = require("../utils");
const coercion_1 = require("../utils/coercion");
const standard_bridge_1 = require("./standard-bridge");

@@ -45,6 +45,6 @@ class ECOBridgeAdapter extends standard_bridge_1.StandardBridgeAdapter {

]);
if (!(0, core_utils_1.hexStringEquals)(remoteL1Token, (0, utils_1.toAddress)(l1Token))) {
if (!(0, core_utils_1.hexStringEquals)(remoteL1Token, (0, coercion_1.toAddress)(l1Token))) {
return false;
}
if (!(0, core_utils_1.hexStringEquals)(remoteL2Token, (0, utils_1.toAddress)(l2Token))) {
if (!(0, core_utils_1.hexStringEquals)(remoteL2Token, (0, coercion_1.toAddress)(l2Token))) {
return false;

@@ -56,1 +56,2 @@ }

exports.ECOBridgeAdapter = ECOBridgeAdapter;
//# sourceMappingURL=eco-bridge.js.map

@@ -8,3 +8,4 @@ "use strict";

const interfaces_1 = require("../interfaces");
const utils_1 = require("../utils");
const coercion_1 = require("../utils/coercion");
const misc_utils_1 = require("../utils/misc-utils");
const standard_bridge_1 = require("./standard-bridge");

@@ -23,6 +24,6 @@ class ETHBridgeAdapter extends standard_bridge_1.StandardBridgeAdapter {

if ((opts === null || opts === void 0 ? void 0 : opts.recipient) === undefined) {
return this.l1Bridge.populateTransaction.depositETH((opts === null || opts === void 0 ? void 0 : opts.l2GasLimit) || 200000, '0x', Object.assign(Object.assign({}, (0, utils_1.omit)((opts === null || opts === void 0 ? void 0 : opts.overrides) || {}, 'value')), { value: amount }));
return this.l1Bridge.populateTransaction.depositETH((opts === null || opts === void 0 ? void 0 : opts.l2GasLimit) || 200000, '0x', Object.assign(Object.assign({}, (0, misc_utils_1.omit)((opts === null || opts === void 0 ? void 0 : opts.overrides) || {}, 'value')), { value: amount }));
}
else {
return this.l1Bridge.populateTransaction.depositETHTo((0, utils_1.toAddress)(opts.recipient), (opts === null || opts === void 0 ? void 0 : opts.l2GasLimit) || 200000, '0x', Object.assign(Object.assign({}, (0, utils_1.omit)((opts === null || opts === void 0 ? void 0 : opts.overrides) || {}, 'value')), { value: amount }));
return this.l1Bridge.populateTransaction.depositETHTo((0, coercion_1.toAddress)(opts.recipient), (opts === null || opts === void 0 ? void 0 : opts.l2GasLimit) || 200000, '0x', Object.assign(Object.assign({}, (0, misc_utils_1.omit)((opts === null || opts === void 0 ? void 0 : opts.overrides) || {}, 'value')), { value: amount }));
}

@@ -35,6 +36,6 @@ },

if ((opts === null || opts === void 0 ? void 0 : opts.recipient) === undefined) {
return this.l2Bridge.populateTransaction.withdraw((0, utils_1.toAddress)(l2Token), amount, 0, '0x', Object.assign(Object.assign({}, (0, utils_1.omit)((opts === null || opts === void 0 ? void 0 : opts.overrides) || {}, 'value')), { value: this.messenger.bedrock ? amount : 0 }));
return this.l2Bridge.populateTransaction.withdraw((0, coercion_1.toAddress)(l2Token), amount, 0, '0x', Object.assign(Object.assign({}, (0, misc_utils_1.omit)((opts === null || opts === void 0 ? void 0 : opts.overrides) || {}, 'value')), { value: this.messenger.bedrock ? amount : 0 }));
}
else {
return this.l2Bridge.populateTransaction.withdrawTo((0, utils_1.toAddress)(l2Token), (0, utils_1.toAddress)(opts.recipient), amount, 0, '0x', Object.assign(Object.assign({}, (0, utils_1.omit)((opts === null || opts === void 0 ? void 0 : opts.overrides) || {}, 'value')), { value: this.messenger.bedrock ? amount : 0 }));
return this.l2Bridge.populateTransaction.withdrawTo((0, coercion_1.toAddress)(l2Token), (0, coercion_1.toAddress)(opts.recipient), amount, 0, '0x', Object.assign(Object.assign({}, (0, misc_utils_1.omit)((opts === null || opts === void 0 ? void 0 : opts.overrides) || {}, 'value')), { value: this.messenger.bedrock ? amount : 0 }));
}

@@ -94,6 +95,7 @@ },

async supportsTokenPair(l1Token, l2Token) {
return ((0, core_utils_1.hexStringEquals)((0, utils_1.toAddress)(l1Token), ethers_1.ethers.constants.AddressZero) &&
(0, core_utils_1.hexStringEquals)((0, utils_1.toAddress)(l2Token), contracts_1.predeploys.OVM_ETH));
return ((0, core_utils_1.hexStringEquals)((0, coercion_1.toAddress)(l1Token), ethers_1.ethers.constants.AddressZero) &&
(0, core_utils_1.hexStringEquals)((0, coercion_1.toAddress)(l2Token), contracts_1.predeploys.OVM_ETH));
}
}
exports.ETHBridgeAdapter = ETHBridgeAdapter;
//# sourceMappingURL=eth-bridge.js.map

@@ -21,1 +21,2 @@ "use strict";

__exportStar(require("./standard-bridge"), exports);
//# sourceMappingURL=index.js.map

@@ -14,3 +14,3 @@ "use strict";

const interfaces_1 = require("../interfaces");
const utils_1 = require("../utils");
const coercion_1 = require("../utils/coercion");
class StandardBridgeAdapter {

@@ -23,3 +23,3 @@ constructor(opts) {

}
const token = new ethers_1.Contract((0, utils_1.toAddress)(l1Token), OptimismMintableERC20_json_1.default.abi, this.messenger.l1Provider);
const token = new ethers_1.Contract((0, coercion_1.toAddress)(l1Token), OptimismMintableERC20_json_1.default.abi, this.messenger.l1Provider);
return token.populateTransaction.approve(this.l1Bridge.address, amount, (opts === null || opts === void 0 ? void 0 : opts.overrides) || {});

@@ -32,6 +32,6 @@ },

if ((opts === null || opts === void 0 ? void 0 : opts.recipient) === undefined) {
return this.l1Bridge.populateTransaction.depositERC20((0, utils_1.toAddress)(l1Token), (0, utils_1.toAddress)(l2Token), amount, (opts === null || opts === void 0 ? void 0 : opts.l2GasLimit) || 200000, '0x', (opts === null || opts === void 0 ? void 0 : opts.overrides) || {});
return this.l1Bridge.populateTransaction.depositERC20((0, coercion_1.toAddress)(l1Token), (0, coercion_1.toAddress)(l2Token), amount, (opts === null || opts === void 0 ? void 0 : opts.l2GasLimit) || 200000, '0x', (opts === null || opts === void 0 ? void 0 : opts.overrides) || {});
}
else {
return this.l1Bridge.populateTransaction.depositERC20To((0, utils_1.toAddress)(l1Token), (0, utils_1.toAddress)(l2Token), (0, utils_1.toAddress)(opts.recipient), amount, (opts === null || opts === void 0 ? void 0 : opts.l2GasLimit) || 200000, '0x', (opts === null || opts === void 0 ? void 0 : opts.overrides) || {});
return this.l1Bridge.populateTransaction.depositERC20To((0, coercion_1.toAddress)(l1Token), (0, coercion_1.toAddress)(l2Token), (0, coercion_1.toAddress)(opts.recipient), amount, (opts === null || opts === void 0 ? void 0 : opts.l2GasLimit) || 200000, '0x', (opts === null || opts === void 0 ? void 0 : opts.overrides) || {});
}

@@ -44,6 +44,6 @@ },

if ((opts === null || opts === void 0 ? void 0 : opts.recipient) === undefined) {
return this.l2Bridge.populateTransaction.withdraw((0, utils_1.toAddress)(l2Token), amount, 0, '0x', (opts === null || opts === void 0 ? void 0 : opts.overrides) || {});
return this.l2Bridge.populateTransaction.withdraw((0, coercion_1.toAddress)(l2Token), amount, 0, '0x', (opts === null || opts === void 0 ? void 0 : opts.overrides) || {});
}
else {
return this.l2Bridge.populateTransaction.withdrawTo((0, utils_1.toAddress)(l2Token), (0, utils_1.toAddress)(opts.recipient), amount, 0, '0x', (opts === null || opts === void 0 ? void 0 : opts.overrides) || {});
return this.l2Bridge.populateTransaction.withdrawTo((0, coercion_1.toAddress)(l2Token), (0, coercion_1.toAddress)(opts.recipient), amount, 0, '0x', (opts === null || opts === void 0 ? void 0 : opts.overrides) || {});
}

@@ -64,4 +64,4 @@ },

this.messenger = opts.messenger;
this.l1Bridge = new ethers_1.Contract((0, utils_1.toAddress)(opts.l1Bridge), L1StandardBridge_json_1.default.abi, this.messenger.l1Provider);
this.l2Bridge = new ethers_1.Contract((0, utils_1.toAddress)(opts.l2Bridge), L2StandardBridge_json_1.default.abi, this.messenger.l2Provider);
this.l1Bridge = new ethers_1.Contract((0, coercion_1.toAddress)(opts.l1Bridge), L1StandardBridge_json_1.default.abi, this.messenger.l1Provider);
this.l2Bridge = new ethers_1.Contract((0, coercion_1.toAddress)(opts.l2Bridge), L2StandardBridge_json_1.default.abi, this.messenger.l2Provider);
}

@@ -119,9 +119,9 @@ async getDepositsByAddress(address, opts) {

async supportsTokenPair(l1Token, l2Token) {
const contract = new ethers_1.Contract((0, utils_1.toAddress)(l2Token), OptimismMintableERC20_json_1.default.abi, this.messenger.l2Provider);
if ((0, core_utils_1.hexStringEquals)((0, utils_1.toAddress)(l1Token), ethers_1.ethers.constants.AddressZero) ||
(0, core_utils_1.hexStringEquals)((0, utils_1.toAddress)(l2Token), contracts_1.predeploys.OVM_ETH)) {
const contract = new ethers_1.Contract((0, coercion_1.toAddress)(l2Token), OptimismMintableERC20_json_1.default.abi, this.messenger.l2Provider);
if ((0, core_utils_1.hexStringEquals)((0, coercion_1.toAddress)(l1Token), ethers_1.ethers.constants.AddressZero) ||
(0, core_utils_1.hexStringEquals)((0, coercion_1.toAddress)(l2Token), contracts_1.predeploys.OVM_ETH)) {
return false;
}
const remoteL1Token = await contract.l1Token();
if (!(0, core_utils_1.hexStringEquals)(remoteL1Token, (0, utils_1.toAddress)(l1Token))) {
if (!(0, core_utils_1.hexStringEquals)(remoteL1Token, (0, coercion_1.toAddress)(l1Token))) {
return false;

@@ -139,3 +139,3 @@ }

}
const token = new ethers_1.Contract((0, utils_1.toAddress)(l1Token), OptimismMintableERC20_json_1.default.abi, this.messenger.l1Provider);
const token = new ethers_1.Contract((0, coercion_1.toAddress)(l1Token), OptimismMintableERC20_json_1.default.abi, this.messenger.l1Provider);
return token.allowance(await signer.getAddress(), this.l1Bridge.address);

@@ -154,1 +154,2 @@ }

exports.StandardBridgeAdapter = StandardBridgeAdapter;
//# sourceMappingURL=standard-bridge.js.map

@@ -1050,1 +1050,2 @@ "use strict";

exports.CrossChainMessenger = CrossChainMessenger;
//# sourceMappingURL=cross-chain-messenger.js.map

@@ -22,1 +22,2 @@ "use strict";

__exportStar(require("./utils"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=bridge-adapter.js.map

@@ -20,1 +20,2 @@ "use strict";

__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=l2-provider.js.map

@@ -48,1 +48,2 @@ "use strict";

})(MessageReceiptStatus || (exports.MessageReceiptStatus = MessageReceiptStatus = {}));
//# sourceMappingURL=types.js.map

@@ -159,1 +159,2 @@ "use strict";

exports.asL2Provider = asL2Provider;
//# sourceMappingURL=l2-provider.js.map

@@ -10,1 +10,2 @@ "use strict";

exports.assert = assert;
//# sourceMappingURL=assert.js.map

@@ -298,1 +298,2 @@ "use strict";

};
//# sourceMappingURL=chain-constants.js.map

@@ -80,1 +80,2 @@ "use strict";

exports.toAddress = toAddress;
//# sourceMappingURL=coercion.js.map

@@ -184,1 +184,2 @@ "use strict";

exports.getBridgeAdapters = getBridgeAdapters;
//# sourceMappingURL=contracts.js.map

@@ -24,1 +24,2 @@ "use strict";

__exportStar(require("./type-utils"), exports);
//# sourceMappingURL=index.js.map

@@ -84,1 +84,2 @@ "use strict";

exports.makeStateTrieProof = makeStateTrieProof;
//# sourceMappingURL=merkle-utils.js.map

@@ -43,1 +43,2 @@ "use strict";

exports.migratedWithdrawalGasLimit = migratedWithdrawalGasLimit;
//# sourceMappingURL=message-utils.js.map

@@ -12,1 +12,2 @@ "use strict";

exports.omit = omit;
//# sourceMappingURL=misc-utils.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=type-utils.js.map
{
"name": "@eth-optimism/sdk",
"version": "0.0.0-main-20240611023711",
"version": "0.0.0-main-20240612131557",
"description": "[Optimism] Tools for working with Optimism",

@@ -51,3 +51,3 @@ "main": "dist/index",

"@eth-optimism/contracts": "0.6.0",
"@eth-optimism/core-utils": "*",
"@eth-optimism/core-utils": "^0.13.2",
"lodash": "^4.17.21",

@@ -54,0 +54,0 @@ "merkletreejs": "^0.3.11",

@@ -6,3 +6,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

import type { AddressLike } from '../interfaces'
import { toAddress } from '../utils'
import { toAddress } from '../utils/coercion'
import { StandardBridgeAdapter } from './standard-bridge'

@@ -9,0 +9,0 @@

@@ -6,3 +6,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

import type { AddressLike } from '../interfaces'
import { toAddress } from '../utils'
import { toAddress } from '../utils/coercion'
import { StandardBridgeAdapter } from './standard-bridge'

@@ -9,0 +9,0 @@

@@ -15,3 +15,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

} from '../interfaces'
import { omit,toAddress } from '../utils'
import { toAddress } from '../utils/coercion'
import { omit } from '../utils/misc-utils'
import { StandardBridgeAdapter } from './standard-bridge'

@@ -18,0 +19,0 @@

@@ -29,3 +29,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */

} from '../interfaces'
import { toAddress } from '../utils'
import { toAddress } from '../utils/coercion'

@@ -32,0 +32,0 @@ /**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc