@rabbitholegg/questdk-plugin-arbitrum
Advanced tools
Comparing version 1.0.0-alpha.16 to 1.0.0-alpha.17
# @rabbitholegg/questdk-plugin-arbitrum | ||
## 1.0.0-alpha.17 | ||
### Minor Changes | ||
- [#385](https://github.com/rabbitholegg/questdk-plugins/pull/385) [`72a86095`](https://github.com/rabbitholegg/questdk-plugins/commit/72a860954036856b073a2043dfc8614c200585d6) Thanks [@sammccord](https://github.com/sammccord)! - use vite for build tooling, reduce plugin size, improve build speeds | ||
## 1.0.0-alpha.16 | ||
@@ -4,0 +10,0 @@ |
@@ -1,53 +0,1 @@ | ||
"use strict"; | ||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Arbitrum = void 0; | ||
var _questdk = require("@rabbitholegg/questdk"); | ||
var _Arbitrum = require("./Arbitrum"); | ||
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } | ||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | ||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | ||
var Arbitrum = exports.Arbitrum = { | ||
pluginId: 'arbitrum', | ||
getSupportedTokenAddresses: _Arbitrum.getSupportedTokenAddresses, | ||
getSupportedChainIds: _Arbitrum.getSupportedChainIds, | ||
bridge: _Arbitrum.bridge, | ||
swap: function () { | ||
var _swap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { | ||
return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
while (1) switch (_context.prev = _context.next) { | ||
case 0: | ||
return _context.abrupt("return", new _questdk.PluginActionNotImplementedError()); | ||
case 1: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee); | ||
})); | ||
function swap() { | ||
return _swap.apply(this, arguments); | ||
} | ||
return swap; | ||
}(), | ||
mint: function () { | ||
var _mint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
return _context2.abrupt("return", new _questdk.PluginActionNotImplementedError()); | ||
case 1: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
}, _callee2); | ||
})); | ||
function mint() { | ||
return _mint.apply(this, arguments); | ||
} | ||
return mint; | ||
}() | ||
}; | ||
//# sourceMappingURL=index.js.map | ||
(function(c,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("@rabbitholegg/questdk")):typeof define=="function"&&define.amd?define(["exports","@rabbitholegg/questdk"],t):(c=typeof globalThis<"u"?globalThis:c||self,t(c.QuestdkPluginArbitrum={},c.questdk))})(this,function(c,t){"use strict";const s="0x0000000000000000000000000000000000000000",D=[1,42161,42170],_="0xc840838bc438d73c16c2f8b22d2ce3669963cd48",A="0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef",b="0x21903d3f8176b1a0c17e953cd896610be9ffdfa8",u="0x5288c571fd7ad117bea99bf60fe0846c4e84f933",p="0x4dbd4fc535ac27206064b68ffcf827b0a60bab3f",y="0xc4448b71118c9071bcb9734a0eac55d18a153949",E="0x0000000000000000000000000000000000000064",B={1:[s,"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0x6B175474E89094C44Da98b954EedeAC495271d0F","0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1","0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599","0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"],42161:[s,"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8","0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1","0x912CE59144191C1204E64559FE8253a0e49E6548","0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f","0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"],42170:[s,"0x750ba8b76187092B0D1E87E28daaf484d1b5273b","0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1","0xf823C3cD3CeBE0a1fA952ba88Dc9EEf8e0Bf46AD","0x1d05e4e72cD994cdF976181CfB0707345763564d","0x722E8BdD2ce80A4422E880164f2079488e115365"]},m=[[JSON.stringify(["0xff970a61a04b1ca14834a43f5de4533ebddb5cc8","0x750ba8b76187092b0d1e87e28daaf484d1b5273b"]),"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"],[JSON.stringify(["0x912CE59144191C1204E64559FE8253a0e49E6548","0xf823C3cD3CeBE0a1fA952ba88Dc9EEf8e0Bf46AD"]),"0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1"],[JSON.stringify(["0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f","0x1d05e4e72cd994cdf976181cfb0707345763564d"]),"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"],[JSON.stringify(["0x82af49447d8a07e3bd95bd0d56f35241523fbab1","0x722e8bdd2ce80a4422e880164f2079488e115365"]),"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"],[JSON.stringify(["0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"]),"0x6b175474e89094c44da98b954eedeac495271d0f"]],l=new Map(m);function x(n){if(n){for(const[e,d]of l)if(JSON.parse(e.toLowerCase()).includes(n.toLowerCase()))return d}}const O=(n,e)=>{if(e!==void 0){if(n===42170)return b;if(n===42161)return u;if(n===1){if(e===42170)return _;if(e===42161)return A}return"0x0"}},I=[{inputs:[{internalType:"address",name:"_token",type:"address"},{internalType:"address",name:"_to",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"},{internalType:"uint256",name:"_maxGas",type:"uint256"},{internalType:"uint256",name:"_gasPriceBid",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"outboundTransfer",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"payable",type:"function"}],N=[{inputs:[{internalType:"address",name:"_l1Token",type:"address"},{internalType:"address",name:"_to",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"outboundTransfer",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"payable",type:"function"}],T=[{inputs:[{internalType:"address",name:"destination",type:"address"}],name:"withdrawEth",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"}],C=[{inputs:[],name:"depositEth",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"payable",type:"function"}],H={pluginId:"arbitrum",getSupportedTokenAddresses:async n=>B[n],getSupportedChainIds:async()=>D,bridge:async n=>{const{sourceChainId:e,destinationChainId:d,contractAddress:o,tokenAddress:r,amount:f,recipient:i}=n;if(!r){const a=e===1?[_,A,p,y]:[u,b,E],R=e===1?[...I,...C]:[...N,...T];return t.compressJson({chainId:e,from:i,to:{$or:a},input:{$abi:R}})}if(r!==s){const a=o||O(e,d);return e!==1?t.compressJson({chainId:e,to:a||{$or:[u,b]},input:{$abi:N,_to:i,_amount:f,_l1Token:x(r)}}):t.compressJson({chainId:e,to:a||{$or:[_,A]},input:{$abi:I,_to:i,_amount:f,_token:r}})}if(e===1){let a;return d&&(a=d===42170?y:p),t.compressJson({chainId:e,to:o||a,from:i,value:f,input:{$abi:C}})}return t.compressJson({chainId:e,value:f,to:o||E,input:{$abi:T,destination:i}})},swap:async()=>new t.PluginActionNotImplementedError,mint:async()=>new t.PluginActionNotImplementedError};c.Arbitrum=H,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}); |
@@ -1,11 +0,253 @@ | ||
import { PluginActionNotImplementedError } from '@rabbitholegg/questdk'; | ||
import { bridge, getSupportedChainIds, getSupportedTokenAddresses } from './Arbitrum'; | ||
export const Arbitrum = { | ||
pluginId: 'arbitrum', | ||
getSupportedTokenAddresses, | ||
getSupportedChainIds, | ||
bridge, | ||
swap: async () => new PluginActionNotImplementedError(), | ||
mint: async () => new PluginActionNotImplementedError() | ||
import { compressJson as i, PluginActionNotImplementedError as E } from "@rabbitholegg/questdk"; | ||
const b = "0x0000000000000000000000000000000000000000", a = 1, u = 42161, r = 42170, O = [ | ||
a, | ||
u, | ||
r | ||
], p = "0xc840838bc438d73c16c2f8b22d2ce3669963cd48", A = "0x72ce9c846789fdb6fc1f34ac4ad25dd9ef7031ef", _ = "0x21903d3f8176b1a0c17e953cd896610be9ffdfa8", y = "0x5288c571fd7ad117bea99bf60fe0846c4e84f933", T = "0x4dbd4fc535ac27206064b68ffcf827b0a60bab3f", B = "0xc4448b71118c9071bcb9734a0eac55d18a153949", x = "0x0000000000000000000000000000000000000064", I = { | ||
[a]: [ | ||
b, | ||
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", | ||
// USDC | ||
"0x6B175474E89094C44Da98b954EedeAC495271d0F", | ||
// DAI | ||
"0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1", | ||
// ARB | ||
"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", | ||
// WBTC | ||
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" | ||
// WETH | ||
], | ||
[u]: [ | ||
b, | ||
"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", | ||
// USDC | ||
"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", | ||
// DAI | ||
"0x912CE59144191C1204E64559FE8253a0e49E6548", | ||
// ARB | ||
"0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", | ||
// WBTC | ||
"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1" | ||
// WETH | ||
], | ||
[r]: [ | ||
b, | ||
"0x750ba8b76187092B0D1E87E28daaf484d1b5273b", | ||
// USDC | ||
"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", | ||
// DAI | ||
"0xf823C3cD3CeBE0a1fA952ba88Dc9EEf8e0Bf46AD", | ||
// ARB | ||
"0x1d05e4e72cD994cdF976181CfB0707345763564d", | ||
// WBTC | ||
"0x722E8BdD2ce80A4422E880164f2079488e115365" | ||
// WETH | ||
] | ||
}, F = [ | ||
[ | ||
// USDC | ||
JSON.stringify([ | ||
"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", | ||
// one | ||
"0x750ba8b76187092b0d1e87e28daaf484d1b5273b" | ||
// nova | ||
]), | ||
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" | ||
// ethereum | ||
], | ||
[ | ||
// ARB | ||
JSON.stringify([ | ||
"0x912CE59144191C1204E64559FE8253a0e49E6548", | ||
// one | ||
"0xf823C3cD3CeBE0a1fA952ba88Dc9EEf8e0Bf46AD" | ||
// nova | ||
]), | ||
"0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1" | ||
// ethereum | ||
], | ||
[ | ||
// WBTC | ||
JSON.stringify([ | ||
"0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", | ||
// one | ||
"0x1d05e4e72cd994cdf976181cfb0707345763564d" | ||
// nova | ||
]), | ||
"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" | ||
// ethereum | ||
], | ||
[ | ||
// WETH | ||
JSON.stringify([ | ||
"0x82af49447d8a07e3bd95bd0d56f35241523fbab1", | ||
// one | ||
"0x722e8bdd2ce80a4422e880164f2079488e115365" | ||
// nova | ||
]), | ||
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" | ||
// ethereum | ||
], | ||
[ | ||
// DAI | ||
JSON.stringify(["0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"]), | ||
// one/nova | ||
"0x6b175474e89094c44da98b954eedeac495271d0f" | ||
// ethereum | ||
] | ||
], R = new Map(F); | ||
function g(t) { | ||
if (t) { | ||
for (const [e, c] of R) | ||
if (JSON.parse(e.toLowerCase()).includes(t.toLowerCase())) | ||
return c; | ||
} | ||
} | ||
const S = (t, e) => { | ||
if (e !== void 0) { | ||
if (t === r) | ||
return _; | ||
if (t === u) | ||
return y; | ||
if (t === a) { | ||
if (e === r) | ||
return p; | ||
if (e === u) | ||
return A; | ||
} | ||
return "0x0"; | ||
} | ||
}, C = [ | ||
{ | ||
inputs: [ | ||
{ internalType: "address", name: "_token", type: "address" }, | ||
{ internalType: "address", name: "_to", type: "address" }, | ||
{ internalType: "uint256", name: "_amount", type: "uint256" }, | ||
{ internalType: "uint256", name: "_maxGas", type: "uint256" }, | ||
{ internalType: "uint256", name: "_gasPriceBid", type: "uint256" }, | ||
{ internalType: "bytes", name: "_data", type: "bytes" } | ||
], | ||
name: "outboundTransfer", | ||
outputs: [{ internalType: "bytes", name: "", type: "bytes" }], | ||
stateMutability: "payable", | ||
type: "function" | ||
} | ||
], m = [ | ||
{ | ||
inputs: [ | ||
{ internalType: "address", name: "_l1Token", type: "address" }, | ||
{ internalType: "address", name: "_to", type: "address" }, | ||
{ internalType: "uint256", name: "_amount", type: "uint256" }, | ||
{ internalType: "bytes", name: "_data", type: "bytes" } | ||
], | ||
name: "outboundTransfer", | ||
outputs: [{ internalType: "bytes", name: "", type: "bytes" }], | ||
stateMutability: "payable", | ||
type: "function" | ||
} | ||
], D = [ | ||
{ | ||
inputs: [{ internalType: "address", name: "destination", type: "address" }], | ||
name: "withdrawEth", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "payable", | ||
type: "function" | ||
} | ||
], N = [ | ||
{ | ||
inputs: [], | ||
name: "depositEth", | ||
outputs: [{ internalType: "uint256", name: "", type: "uint256" }], | ||
stateMutability: "payable", | ||
type: "function" | ||
} | ||
], k = async (t) => { | ||
const { | ||
sourceChainId: e, | ||
destinationChainId: c, | ||
contractAddress: s, | ||
tokenAddress: o, | ||
amount: f, | ||
recipient: d | ||
} = t; | ||
if (!o) { | ||
const n = e === a ? [ | ||
p, | ||
A, | ||
T, | ||
B | ||
] : [ | ||
y, | ||
_, | ||
x | ||
], l = e === a ? [...C, ...N] : [...m, ...D]; | ||
return i({ | ||
chainId: e, | ||
from: d, | ||
to: { | ||
$or: n | ||
}, | ||
input: { | ||
$abi: l | ||
} | ||
}); | ||
} | ||
if (o !== b) { | ||
const n = s || S(e, c); | ||
return e !== a ? i({ | ||
// L2 to L1 Token Transfer | ||
chainId: e, | ||
to: n || { | ||
$or: [y, _] | ||
}, | ||
input: { | ||
$abi: m, | ||
_to: d, | ||
_amount: f, | ||
_l1Token: g(o) | ||
} | ||
}) : i({ | ||
chainId: e, | ||
to: n || { | ||
$or: [p, A] | ||
}, | ||
input: { | ||
$abi: C, | ||
_to: d, | ||
_amount: f, | ||
_token: o | ||
} | ||
}); | ||
} | ||
if (e === a) { | ||
let n; | ||
return c && (n = c === r ? B : T), i({ | ||
chainId: e, | ||
to: s || n, | ||
from: d, | ||
value: f, | ||
input: { | ||
$abi: N | ||
} | ||
}); | ||
} | ||
return i({ | ||
chainId: e, | ||
value: f, | ||
to: s || x, | ||
input: { | ||
$abi: D, | ||
destination: d | ||
} | ||
}); | ||
}, L = async (t) => I[t], M = async () => O, h = { | ||
pluginId: "arbitrum", | ||
getSupportedTokenAddresses: L, | ||
getSupportedChainIds: M, | ||
bridge: k, | ||
swap: async () => new E(), | ||
mint: async () => new E() | ||
}; | ||
//# sourceMappingURL=index.js.map | ||
export { | ||
h as Arbitrum | ||
}; |
{ | ||
"name": "@rabbitholegg/questdk-plugin-arbitrum", | ||
"version": "1.0.0-alpha.16", | ||
"version": "1.0.0-alpha.17", | ||
"exports": { | ||
@@ -11,22 +11,15 @@ "require": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.js", | ||
"description": "", | ||
"types": "./dist/types/index.d.ts", | ||
"typings": "./dist/types/index.d.ts", | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"types": "./dist/types/index.d.ts", | ||
"typings": "./dist/types/index.d.ts", | ||
"devDependencies": { | ||
"tsconfig": "0.1.0-alpha.1", | ||
"@rabbitholegg/questdk": "2.0.0-alpha.47" | ||
"@rabbitholegg/questdk": "2.0.0-alpha.52" | ||
}, | ||
"scripts": { | ||
"build": "vite build && tsc --project tsconfig.build.json --emitDeclarationOnly --declaration --declarationMap --declarationDir ./dist/types", | ||
"bench": "vitest bench", | ||
"bench:ci": "CI=true vitest bench", | ||
"build": "pnpm build:types && pnpm build:esm && pnpm postbuild:esm && pnpm build:cjs && pnpm postbuild:cjs && BABEL_ENV=esmBundled pnpm rollup -c", | ||
"build:esm": "BABEL_ENV=esmUnbundled babel src --extensions '.ts' --out-dir 'dist/esm' --source-maps", | ||
"build:cjs": "BABEL_ENV=cjs babel src --extensions '.ts' --out-dir 'dist/cjs' --source-maps", | ||
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap", | ||
"clean": "rimraf dist", | ||
"postbuild:cjs": "echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json", | ||
"postbuild:esm": "echo '{\"type\":\"module\"}' > dist/esm/package.json", | ||
"format": "rome format . --write", | ||
@@ -33,0 +26,0 @@ "lint": "eslint .", |
{ | ||
"extends": "tsconfig/base.json", | ||
"extends": "../../tsconfig.json", | ||
"include": ["src"], | ||
@@ -13,5 +13,4 @@ "exclude": [ | ||
"sourceMap": true, | ||
"rootDir": "./src", | ||
"rootDir": "./src" | ||
} | ||
} |
{ | ||
"extends": "tsconfig/base.json", | ||
"extends": "../../tsconfig.json", | ||
"include": ["src/**/*", "src/chain-data.ts"], | ||
"exclude": ["dist", "build", "node_modules"] | ||
} |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
223679
52
1694
3
1