@gardenfi/core 0.2.0-beta.75 → 0.2.0-beta.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +31 -1
- package/dist/index.js +7813 -28
- package/package.json +1 -1
- package/dist/index10.cjs +0 -1
- package/dist/index10.js +0 -112
- package/dist/index100.cjs +0 -1
- package/dist/index100.js +0 -23
- package/dist/index101.cjs +0 -1
- package/dist/index101.js +0 -9
- package/dist/index102.cjs +0 -1
- package/dist/index102.js +0 -35
- package/dist/index103.cjs +0 -1
- package/dist/index103.js +0 -4
- package/dist/index104.cjs +0 -1
- package/dist/index104.js +0 -40
- package/dist/index105.cjs +0 -1
- package/dist/index105.js +0 -31
- package/dist/index106.cjs +0 -1
- package/dist/index106.js +0 -9
- package/dist/index107.cjs +0 -1
- package/dist/index107.js +0 -7
- package/dist/index108.cjs +0 -1
- package/dist/index108.js +0 -13
- package/dist/index109.cjs +0 -1
- package/dist/index109.js +0 -4
- package/dist/index11.cjs +0 -20
- package/dist/index11.js +0 -380
- package/dist/index110.cjs +0 -1
- package/dist/index110.js +0 -60
- package/dist/index111.cjs +0 -1
- package/dist/index111.js +0 -4
- package/dist/index112.cjs +0 -1
- package/dist/index112.js +0 -42
- package/dist/index113.cjs +0 -1
- package/dist/index113.js +0 -45
- package/dist/index114.cjs +0 -1
- package/dist/index114.js +0 -20
- package/dist/index115.cjs +0 -1
- package/dist/index115.js +0 -111
- package/dist/index116.cjs +0 -1
- package/dist/index116.js +0 -23
- package/dist/index117.cjs +0 -1
- package/dist/index117.js +0 -228
- package/dist/index118.cjs +0 -1
- package/dist/index118.js +0 -6
- package/dist/index119.cjs +0 -1
- package/dist/index119.js +0 -160
- package/dist/index12.cjs +0 -1
- package/dist/index12.js +0 -22
- package/dist/index120.cjs +0 -1
- package/dist/index120.js +0 -4
- package/dist/index121.cjs +0 -1
- package/dist/index121.js +0 -75
- package/dist/index122.cjs +0 -1
- package/dist/index122.js +0 -64
- package/dist/index123.cjs +0 -1
- package/dist/index123.js +0 -37
- package/dist/index124.cjs +0 -1
- package/dist/index124.js +0 -7
- package/dist/index125.cjs +0 -1
- package/dist/index125.js +0 -107
- package/dist/index126.cjs +0 -1
- package/dist/index126.js +0 -15
- package/dist/index127.cjs +0 -1
- package/dist/index127.js +0 -35
- package/dist/index128.cjs +0 -1
- package/dist/index128.js +0 -4
- package/dist/index129.cjs +0 -1
- package/dist/index129.js +0 -32
- package/dist/index13.cjs +0 -1
- package/dist/index13.js +0 -396
- package/dist/index130.cjs +0 -1
- package/dist/index130.js +0 -4
- package/dist/index131.cjs +0 -1
- package/dist/index131.js +0 -358
- package/dist/index132.cjs +0 -1
- package/dist/index132.js +0 -241
- package/dist/index133.cjs +0 -1
- package/dist/index133.js +0 -70
- package/dist/index134.cjs +0 -1
- package/dist/index134.js +0 -64
- package/dist/index135.cjs +0 -1
- package/dist/index135.js +0 -14
- package/dist/index136.cjs +0 -1
- package/dist/index136.js +0 -47
- package/dist/index137.cjs +0 -1
- package/dist/index137.js +0 -65
- package/dist/index138.cjs +0 -1
- package/dist/index138.js +0 -21
- package/dist/index139.cjs +0 -1
- package/dist/index139.js +0 -228
- package/dist/index14.cjs +0 -1
- package/dist/index14.js +0 -28
- package/dist/index140.cjs +0 -1
- package/dist/index140.js +0 -5
- package/dist/index141.cjs +0 -1
- package/dist/index141.js +0 -171
- package/dist/index142.cjs +0 -1
- package/dist/index142.js +0 -30
- package/dist/index143.cjs +0 -1
- package/dist/index143.js +0 -23
- package/dist/index144.cjs +0 -1
- package/dist/index144.js +0 -72
- package/dist/index145.cjs +0 -1
- package/dist/index145.js +0 -130
- package/dist/index146.cjs +0 -1
- package/dist/index146.js +0 -9
- package/dist/index147.cjs +0 -1
- package/dist/index147.js +0 -4
- package/dist/index148.cjs +0 -1
- package/dist/index148.js +0 -28
- package/dist/index149.cjs +0 -1
- package/dist/index149.js +0 -4
- package/dist/index15.cjs +0 -1
- package/dist/index15.js +0 -34
- package/dist/index16.cjs +0 -1
- package/dist/index16.js +0 -27
- package/dist/index17.cjs +0 -1
- package/dist/index17.js +0 -33
- package/dist/index18.cjs +0 -1
- package/dist/index18.js +0 -32
- package/dist/index19.cjs +0 -1
- package/dist/index19.js +0 -55
- package/dist/index2.cjs +0 -1
- package/dist/index2.js +0 -412
- package/dist/index20.cjs +0 -1
- package/dist/index20.js +0 -28
- package/dist/index21.cjs +0 -1
- package/dist/index21.js +0 -4
- package/dist/index22.cjs +0 -1
- package/dist/index22.js +0 -140
- package/dist/index23.cjs +0 -1
- package/dist/index23.js +0 -4
- package/dist/index24.cjs +0 -1
- package/dist/index24.js +0 -11
- package/dist/index25.cjs +0 -1
- package/dist/index25.js +0 -11
- package/dist/index26.cjs +0 -3
- package/dist/index26.js +0 -30
- package/dist/index27.cjs +0 -1
- package/dist/index27.js +0 -17
- package/dist/index28.cjs +0 -2
- package/dist/index28.js +0 -27
- package/dist/index29.cjs +0 -1
- package/dist/index29.js +0 -43
- package/dist/index3.cjs +0 -1
- package/dist/index3.js +0 -5
- package/dist/index30.cjs +0 -1
- package/dist/index30.js +0 -201
- package/dist/index31.cjs +0 -1
- package/dist/index31.js +0 -4
- package/dist/index32.cjs +0 -1
- package/dist/index32.js +0 -4
- package/dist/index33.cjs +0 -1
- package/dist/index33.js +0 -4
- package/dist/index34.cjs +0 -1
- package/dist/index34.js +0 -15
- package/dist/index35.cjs +0 -1
- package/dist/index35.js +0 -39
- package/dist/index36.cjs +0 -1
- package/dist/index36.js +0 -44
- package/dist/index37.cjs +0 -1
- package/dist/index37.js +0 -30
- package/dist/index38.cjs +0 -1
- package/dist/index38.js +0 -17
- package/dist/index39.cjs +0 -1
- package/dist/index39.js +0 -26
- package/dist/index4.cjs +0 -1
- package/dist/index4.js +0 -18
- package/dist/index40.cjs +0 -1
- package/dist/index40.js +0 -28
- package/dist/index41.cjs +0 -1
- package/dist/index41.js +0 -57
- package/dist/index42.cjs +0 -1
- package/dist/index42.js +0 -30
- package/dist/index43.cjs +0 -1
- package/dist/index43.js +0 -177
- package/dist/index44.cjs +0 -1
- package/dist/index44.js +0 -4
- package/dist/index45.cjs +0 -1
- package/dist/index45.js +0 -37
- package/dist/index46.cjs +0 -1
- package/dist/index46.js +0 -11
- package/dist/index47.cjs +0 -1
- package/dist/index47.js +0 -15
- package/dist/index48.cjs +0 -1
- package/dist/index48.js +0 -14
- package/dist/index49.cjs +0 -1
- package/dist/index49.js +0 -6
- package/dist/index5.cjs +0 -1
- package/dist/index5.js +0 -99
- package/dist/index50.cjs +0 -1
- package/dist/index50.js +0 -48
- package/dist/index51.cjs +0 -1
- package/dist/index51.js +0 -45
- package/dist/index52.cjs +0 -1
- package/dist/index52.js +0 -174
- package/dist/index53.cjs +0 -1
- package/dist/index53.js +0 -15
- package/dist/index54.cjs +0 -1
- package/dist/index54.js +0 -7
- package/dist/index55.cjs +0 -1
- package/dist/index55.js +0 -19
- package/dist/index56.cjs +0 -1
- package/dist/index56.js +0 -14
- package/dist/index57.cjs +0 -1
- package/dist/index57.js +0 -22
- package/dist/index58.cjs +0 -1
- package/dist/index58.js +0 -34
- package/dist/index59.cjs +0 -1
- package/dist/index59.js +0 -4
- package/dist/index6.cjs +0 -1
- package/dist/index6.js +0 -5
- package/dist/index60.cjs +0 -6
- package/dist/index60.js +0 -949
- package/dist/index61.cjs +0 -1
- package/dist/index61.js +0 -4
- package/dist/index62.cjs +0 -1
- package/dist/index62.js +0 -64
- package/dist/index63.cjs +0 -1
- package/dist/index63.js +0 -35
- package/dist/index64.cjs +0 -1
- package/dist/index64.js +0 -89
- package/dist/index65.cjs +0 -1
- package/dist/index65.js +0 -58
- package/dist/index66.cjs +0 -2
- package/dist/index66.js +0 -62
- package/dist/index67.cjs +0 -1
- package/dist/index67.js +0 -6
- package/dist/index68.cjs +0 -1
- package/dist/index68.js +0 -37
- package/dist/index69.cjs +0 -1
- package/dist/index69.js +0 -130
- package/dist/index7.cjs +0 -1
- package/dist/index7.js +0 -76
- package/dist/index70.cjs +0 -2
- package/dist/index70.js +0 -45
- package/dist/index71.cjs +0 -1
- package/dist/index71.js +0 -11
- package/dist/index72.cjs +0 -1
- package/dist/index72.js +0 -13
- package/dist/index73.cjs +0 -1
- package/dist/index73.js +0 -14
- package/dist/index74.cjs +0 -1
- package/dist/index74.js +0 -16
- package/dist/index75.cjs +0 -1
- package/dist/index75.js +0 -9
- package/dist/index76.cjs +0 -1
- package/dist/index76.js +0 -20
- package/dist/index77.cjs +0 -1
- package/dist/index77.js +0 -81
- package/dist/index78.cjs +0 -1
- package/dist/index78.js +0 -17
- package/dist/index79.cjs +0 -1
- package/dist/index79.js +0 -21
- package/dist/index8.cjs +0 -1
- package/dist/index8.js +0 -61
- package/dist/index80.cjs +0 -1
- package/dist/index80.js +0 -24
- package/dist/index81.cjs +0 -1
- package/dist/index81.js +0 -16
- package/dist/index82.cjs +0 -1
- package/dist/index82.js +0 -9
- package/dist/index83.cjs +0 -1
- package/dist/index83.js +0 -4
- package/dist/index84.cjs +0 -1
- package/dist/index84.js +0 -4
- package/dist/index85.cjs +0 -2
- package/dist/index85.js +0 -37
- package/dist/index86.cjs +0 -1
- package/dist/index86.js +0 -8
- package/dist/index87.cjs +0 -1
- package/dist/index87.js +0 -22
- package/dist/index88.cjs +0 -1
- package/dist/index88.js +0 -37
- package/dist/index89.cjs +0 -1
- package/dist/index89.js +0 -369
- package/dist/index9.cjs +0 -1
- package/dist/index9.js +0 -63
- package/dist/index90.cjs +0 -1
- package/dist/index90.js +0 -23
- package/dist/index91.cjs +0 -1
- package/dist/index91.js +0 -58
- package/dist/index92.cjs +0 -1
- package/dist/index92.js +0 -5
- package/dist/index93.cjs +0 -1
- package/dist/index93.js +0 -51
- package/dist/index94.cjs +0 -1
- package/dist/index94.js +0 -28
- package/dist/index95.cjs +0 -1
- package/dist/index95.js +0 -4
- package/dist/index96.cjs +0 -1
- package/dist/index96.js +0 -4
- package/dist/index97.cjs +0 -1
- package/dist/index97.js +0 -15
- package/dist/index98.cjs +0 -1
- package/dist/index98.js +0 -9
- package/dist/index99.cjs +0 -1
- package/dist/index99.js +0 -115
package/dist/index4.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Fetcher as e, Ok as c, Err as o } from "@catalogfi/utils";
|
|
2
|
-
import { Url as s } from "@gardenfi/utils";
|
|
3
|
-
class n {
|
|
4
|
-
constructor(r, t) {
|
|
5
|
-
this.url = new s("/blocknumber/" + t, r);
|
|
6
|
-
}
|
|
7
|
-
async fetchBlockNumbers() {
|
|
8
|
-
try {
|
|
9
|
-
const r = await e.get(this.url);
|
|
10
|
-
return c(r);
|
|
11
|
-
} catch (r) {
|
|
12
|
-
return o("Failed to fetch block numbers", r);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
n as BlockNumberFetcher
|
|
18
|
-
};
|
package/dist/index40.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index55.cjs"),u=require("./index41.cjs");function i(e){var t;const s=(t=e.transactions)==null?void 0:t.map(n=>typeof n=="string"?n:u.formatTransaction(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:s,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const f=a.defineFormatter("block",i);exports.defineBlock=f;exports.formatBlock=i;
|
package/dist/index40.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defineFormatter as t } from "./index55.js";
|
|
2
|
-
import { formatTransaction as a } from "./index41.js";
|
|
3
|
-
function f(e) {
|
|
4
|
-
var i;
|
|
5
|
-
const s = (i = e.transactions) == null ? void 0 : i.map((n) => typeof n == "string" ? n : a(n));
|
|
6
|
-
return {
|
|
7
|
-
...e,
|
|
8
|
-
baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
|
|
9
|
-
blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
|
|
10
|
-
difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
|
|
11
|
-
excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
|
|
12
|
-
gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
|
|
13
|
-
gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
|
|
14
|
-
hash: e.hash ? e.hash : null,
|
|
15
|
-
logsBloom: e.logsBloom ? e.logsBloom : null,
|
|
16
|
-
nonce: e.nonce ? e.nonce : null,
|
|
17
|
-
number: e.number ? BigInt(e.number) : null,
|
|
18
|
-
size: e.size ? BigInt(e.size) : void 0,
|
|
19
|
-
timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
|
|
20
|
-
transactions: s,
|
|
21
|
-
totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const m = /* @__PURE__ */ t("block", f);
|
|
25
|
-
export {
|
|
26
|
-
m as defineBlock,
|
|
27
|
-
f as formatBlock
|
|
28
|
-
};
|
package/dist/index41.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index39.cjs"),l=require("./index55.cjs"),d={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function u(e){const r={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?i.hexToNumber(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?i.hexToNumber(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?d[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(r.authorizationList=m(e.authorizationList)),r.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof r.v=="bigint"){if(r.v===0n||r.v===27n)return 0;if(r.v===1n||r.v===28n)return 1;if(r.v>=35n)return r.v%2n===0n?1:0}})(),r.type==="legacy"&&(delete r.accessList,delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.yParity),r.type==="eip2930"&&(delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas),r.type==="eip1559"&&delete r.maxFeePerBlobGas,r}const n=l.defineFormatter("transaction",u);function m(e){return e.map(r=>({contractAddress:r.address,chainId:Number(r.chainId),nonce:Number(r.nonce),r:r.r,s:r.s,yParity:Number(r.yParity)}))}exports.defineTransaction=n;exports.formatTransaction=u;exports.transactionType=d;
|
package/dist/index41.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { hexToNumber as r } from "./index39.js";
|
|
2
|
-
import { defineFormatter as i } from "./index55.js";
|
|
3
|
-
const u = {
|
|
4
|
-
"0x0": "legacy",
|
|
5
|
-
"0x1": "eip2930",
|
|
6
|
-
"0x2": "eip1559",
|
|
7
|
-
"0x3": "eip4844",
|
|
8
|
-
"0x4": "eip7702"
|
|
9
|
-
};
|
|
10
|
-
function l(e) {
|
|
11
|
-
const d = {
|
|
12
|
-
...e,
|
|
13
|
-
blockHash: e.blockHash ? e.blockHash : null,
|
|
14
|
-
blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
|
|
15
|
-
chainId: e.chainId ? r(e.chainId) : void 0,
|
|
16
|
-
gas: e.gas ? BigInt(e.gas) : void 0,
|
|
17
|
-
gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
|
|
18
|
-
maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
|
|
19
|
-
maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
|
|
20
|
-
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
|
|
21
|
-
nonce: e.nonce ? r(e.nonce) : void 0,
|
|
22
|
-
to: e.to ? e.to : null,
|
|
23
|
-
transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
|
|
24
|
-
type: e.type ? u[e.type] : void 0,
|
|
25
|
-
typeHex: e.type ? e.type : void 0,
|
|
26
|
-
value: e.value ? BigInt(e.value) : void 0,
|
|
27
|
-
v: e.v ? BigInt(e.v) : void 0
|
|
28
|
-
};
|
|
29
|
-
return e.authorizationList && (d.authorizationList = m(e.authorizationList)), d.yParity = (() => {
|
|
30
|
-
if (e.yParity)
|
|
31
|
-
return Number(e.yParity);
|
|
32
|
-
if (typeof d.v == "bigint") {
|
|
33
|
-
if (d.v === 0n || d.v === 27n)
|
|
34
|
-
return 0;
|
|
35
|
-
if (d.v === 1n || d.v === 28n)
|
|
36
|
-
return 1;
|
|
37
|
-
if (d.v >= 35n)
|
|
38
|
-
return d.v % 2n === 0n ? 1 : 0;
|
|
39
|
-
}
|
|
40
|
-
})(), d.type === "legacy" && (delete d.accessList, delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas, delete d.yParity), d.type === "eip2930" && (delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas), d.type === "eip1559" && delete d.maxFeePerBlobGas, d;
|
|
41
|
-
}
|
|
42
|
-
const P = /* @__PURE__ */ i("transaction", l);
|
|
43
|
-
function m(e) {
|
|
44
|
-
return e.map((d) => ({
|
|
45
|
-
contractAddress: d.address,
|
|
46
|
-
chainId: Number(d.chainId),
|
|
47
|
-
nonce: Number(d.nonce),
|
|
48
|
-
r: d.r,
|
|
49
|
-
s: d.s,
|
|
50
|
-
yParity: Number(d.yParity)
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
export {
|
|
54
|
-
P as defineTransaction,
|
|
55
|
-
l as formatTransaction,
|
|
56
|
-
u as transactionType
|
|
57
|
-
};
|
package/dist/index42.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index39.cjs"),o=require("./index55.cjs"),b=require("./index56.cjs"),f=require("./index41.cjs"),l={"0x0":"reverted","0x1":"success"};function u(e){const s={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>b.formatLog(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?d.hexToNumber(e.transactionIndex):null,status:e.status?l[e.status]:null,type:e.type?f.transactionType[e.type]||e.type:null};return e.blobGasPrice&&(s.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(s.blobGasUsed=BigInt(e.blobGasUsed)),s}const g=o.defineFormatter("transactionReceipt",u);exports.defineTransactionReceipt=g;exports.formatTransactionReceipt=u;exports.receiptStatuses=l;
|
package/dist/index42.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { hexToNumber as d } from "./index39.js";
|
|
2
|
-
import { defineFormatter as b } from "./index55.js";
|
|
3
|
-
import { formatLog as m } from "./index56.js";
|
|
4
|
-
import { transactionType as o } from "./index41.js";
|
|
5
|
-
const f = {
|
|
6
|
-
"0x0": "reverted",
|
|
7
|
-
"0x1": "success"
|
|
8
|
-
};
|
|
9
|
-
function r(l) {
|
|
10
|
-
const s = {
|
|
11
|
-
...l,
|
|
12
|
-
blockNumber: l.blockNumber ? BigInt(l.blockNumber) : null,
|
|
13
|
-
contractAddress: l.contractAddress ? l.contractAddress : null,
|
|
14
|
-
cumulativeGasUsed: l.cumulativeGasUsed ? BigInt(l.cumulativeGasUsed) : null,
|
|
15
|
-
effectiveGasPrice: l.effectiveGasPrice ? BigInt(l.effectiveGasPrice) : null,
|
|
16
|
-
gasUsed: l.gasUsed ? BigInt(l.gasUsed) : null,
|
|
17
|
-
logs: l.logs ? l.logs.map((u) => m(u)) : null,
|
|
18
|
-
to: l.to ? l.to : null,
|
|
19
|
-
transactionIndex: l.transactionIndex ? d(l.transactionIndex) : null,
|
|
20
|
-
status: l.status ? f[l.status] : null,
|
|
21
|
-
type: l.type ? o[l.type] || l.type : null
|
|
22
|
-
};
|
|
23
|
-
return l.blobGasPrice && (s.blobGasPrice = BigInt(l.blobGasPrice)), l.blobGasUsed && (s.blobGasUsed = BigInt(l.blobGasUsed)), s;
|
|
24
|
-
}
|
|
25
|
-
const U = /* @__PURE__ */ b("transactionReceipt", r);
|
|
26
|
-
export {
|
|
27
|
-
U as defineTransactionReceipt,
|
|
28
|
-
r as formatTransactionReceipt,
|
|
29
|
-
f as receiptStatuses
|
|
30
|
-
};
|
package/dist/index43.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./index62.cjs"),J=require("./index63.cjs"),j=require("./index64.cjs");var d=_.errors,u=J.native,h=d.tfJSON,S=d.TfTypeError,b=d.TfPropertyTypeError,v=d.tfSubError,w=d.getValueTypeName,g={arrayOf:function(n,r){n=l(n),r=r||{};function t(f,i){return!u.Array(f)||u.Nil(f)||r.minLength!==void 0&&f.length<r.minLength||r.maxLength!==void 0&&f.length>r.maxLength||r.length!==void 0&&f.length!==r.length?!1:f.every(function(a,o){try{return c(n,a,i)}catch(m){throw v(m,o)}})}return t.toJSON=function(){var f="["+h(n)+"]";return r.length!==void 0?f+="{"+r.length+"}":(r.minLength!==void 0||r.maxLength!==void 0)&&(f+="{"+(r.minLength===void 0?0:r.minLength)+","+(r.maxLength===void 0?1/0:r.maxLength)+"}"),f},t},maybe:function e(n){n=l(n);function r(t,f){return u.Nil(t)||n(t,f,e)}return r.toJSON=function(){return"?"+h(n)},r},map:function(n,r){n=l(n),r&&(r=l(r));function t(f,i){if(!u.Object(f)||u.Nil(f))return!1;for(var a in f){try{r&&c(r,a,i)}catch(m){throw v(m,a,"key")}try{var o=f[a];c(n,o,i)}catch(m){throw v(m,a)}}return!0}return r?t.toJSON=function(){return"{"+h(r)+": "+h(n)+"}"}:t.toJSON=function(){return"{"+h(n)+"}"},t},object:function(n){var r={};for(var t in n)r[t]=l(n[t]);function f(i,a){if(!u.Object(i)||u.Nil(i))return!1;var o;try{for(o in r){var m=r[o],E=i[o];c(m,E,a)}}catch(L){throw v(L,o)}if(a){for(o in i)if(!r[o])throw new b(void 0,o)}return!0}return f.toJSON=function(){return h(r)},f},anyOf:function(){var n=[].slice.call(arguments).map(l);function r(t,f){return n.some(function(i){try{return c(i,t,f)}catch{return!1}})}return r.toJSON=function(){return n.map(h).join("|")},r},allOf:function(){var n=[].slice.call(arguments).map(l);function r(t,f){return n.every(function(i){try{return c(i,t,f)}catch{return!1}})}return r.toJSON=function(){return n.map(h).join(" & ")},r},quacksLike:function(n){function r(t){return n===w(t)}return r.toJSON=function(){return n},r},tuple:function(){var n=[].slice.call(arguments).map(l);function r(t,f){return u.Nil(t)||u.Nil(t.length)||f&&t.length!==n.length?!1:n.every(function(i,a){try{return c(i,t[a],f)}catch(o){throw v(o,a)}})}return r.toJSON=function(){return"("+n.map(h).join(", ")+")"},r},value:function(n){function r(t){return t===n}return r.toJSON=function(){return n},r}};g.oneOf=g.anyOf;function l(e){if(u.String(e))return e[0]==="?"?g.maybe(e.slice(1)):u[e]||g.quacksLike(e);if(e&&u.Object(e)){if(u.Array(e)){if(e.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return g.arrayOf(e[0])}return g.object(e)}else if(u.Function(e))return e;return g.value(e)}function c(e,n,r,t){if(u.Function(e)){if(e(n,r))return!0;throw new S(t||e,n)}return c(l(e),n,r)}for(var O in u)c[O]=u[O];for(O in g)c[O]=g[O];var s=j.__require();for(O in s)c[O]=s[O];c.compile=l;c.TfTypeError=S;c.TfPropertyTypeError=b;var N=c;exports.typeforce_1=N;
|
package/dist/index43.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { e as J } from "./index62.js";
|
|
2
|
-
import { n as _ } from "./index63.js";
|
|
3
|
-
import { __require as w } from "./index64.js";
|
|
4
|
-
var d = J, u = _, h = d.tfJSON, S = d.TfTypeError, E = d.TfPropertyTypeError, v = d.tfSubError, N = d.getValueTypeName, g = {
|
|
5
|
-
arrayOf: function(n, r) {
|
|
6
|
-
n = l(n), r = r || {};
|
|
7
|
-
function f(t, i) {
|
|
8
|
-
return !u.Array(t) || u.Nil(t) || r.minLength !== void 0 && t.length < r.minLength || r.maxLength !== void 0 && t.length > r.maxLength || r.length !== void 0 && t.length !== r.length ? !1 : t.every(function(c, o) {
|
|
9
|
-
try {
|
|
10
|
-
return a(n, c, i);
|
|
11
|
-
} catch (O) {
|
|
12
|
-
throw v(O, o);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return f.toJSON = function() {
|
|
17
|
-
var t = "[" + h(n) + "]";
|
|
18
|
-
return r.length !== void 0 ? t += "{" + r.length + "}" : (r.minLength !== void 0 || r.maxLength !== void 0) && (t += "{" + (r.minLength === void 0 ? 0 : r.minLength) + "," + (r.maxLength === void 0 ? 1 / 0 : r.maxLength) + "}"), t;
|
|
19
|
-
}, f;
|
|
20
|
-
},
|
|
21
|
-
maybe: function e(n) {
|
|
22
|
-
n = l(n);
|
|
23
|
-
function r(f, t) {
|
|
24
|
-
return u.Nil(f) || n(f, t, e);
|
|
25
|
-
}
|
|
26
|
-
return r.toJSON = function() {
|
|
27
|
-
return "?" + h(n);
|
|
28
|
-
}, r;
|
|
29
|
-
},
|
|
30
|
-
map: function(n, r) {
|
|
31
|
-
n = l(n), r && (r = l(r));
|
|
32
|
-
function f(t, i) {
|
|
33
|
-
if (!u.Object(t) || u.Nil(t)) return !1;
|
|
34
|
-
for (var c in t) {
|
|
35
|
-
try {
|
|
36
|
-
r && a(r, c, i);
|
|
37
|
-
} catch (O) {
|
|
38
|
-
throw v(O, c, "key");
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
var o = t[c];
|
|
42
|
-
a(n, o, i);
|
|
43
|
-
} catch (O) {
|
|
44
|
-
throw v(O, c);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return !0;
|
|
48
|
-
}
|
|
49
|
-
return r ? f.toJSON = function() {
|
|
50
|
-
return "{" + h(r) + ": " + h(n) + "}";
|
|
51
|
-
} : f.toJSON = function() {
|
|
52
|
-
return "{" + h(n) + "}";
|
|
53
|
-
}, f;
|
|
54
|
-
},
|
|
55
|
-
object: function(n) {
|
|
56
|
-
var r = {};
|
|
57
|
-
for (var f in n)
|
|
58
|
-
r[f] = l(n[f]);
|
|
59
|
-
function t(i, c) {
|
|
60
|
-
if (!u.Object(i) || u.Nil(i)) return !1;
|
|
61
|
-
var o;
|
|
62
|
-
try {
|
|
63
|
-
for (o in r) {
|
|
64
|
-
var O = r[o], L = i[o];
|
|
65
|
-
a(O, L, c);
|
|
66
|
-
}
|
|
67
|
-
} catch (b) {
|
|
68
|
-
throw v(b, o);
|
|
69
|
-
}
|
|
70
|
-
if (c) {
|
|
71
|
-
for (o in i)
|
|
72
|
-
if (!r[o])
|
|
73
|
-
throw new E(void 0, o);
|
|
74
|
-
}
|
|
75
|
-
return !0;
|
|
76
|
-
}
|
|
77
|
-
return t.toJSON = function() {
|
|
78
|
-
return h(r);
|
|
79
|
-
}, t;
|
|
80
|
-
},
|
|
81
|
-
anyOf: function() {
|
|
82
|
-
var n = [].slice.call(arguments).map(l);
|
|
83
|
-
function r(f, t) {
|
|
84
|
-
return n.some(function(i) {
|
|
85
|
-
try {
|
|
86
|
-
return a(i, f, t);
|
|
87
|
-
} catch {
|
|
88
|
-
return !1;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
return r.toJSON = function() {
|
|
93
|
-
return n.map(h).join("|");
|
|
94
|
-
}, r;
|
|
95
|
-
},
|
|
96
|
-
allOf: function() {
|
|
97
|
-
var n = [].slice.call(arguments).map(l);
|
|
98
|
-
function r(f, t) {
|
|
99
|
-
return n.every(function(i) {
|
|
100
|
-
try {
|
|
101
|
-
return a(i, f, t);
|
|
102
|
-
} catch {
|
|
103
|
-
return !1;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
return r.toJSON = function() {
|
|
108
|
-
return n.map(h).join(" & ");
|
|
109
|
-
}, r;
|
|
110
|
-
},
|
|
111
|
-
quacksLike: function(n) {
|
|
112
|
-
function r(f) {
|
|
113
|
-
return n === N(f);
|
|
114
|
-
}
|
|
115
|
-
return r.toJSON = function() {
|
|
116
|
-
return n;
|
|
117
|
-
}, r;
|
|
118
|
-
},
|
|
119
|
-
tuple: function() {
|
|
120
|
-
var n = [].slice.call(arguments).map(l);
|
|
121
|
-
function r(f, t) {
|
|
122
|
-
return u.Nil(f) || u.Nil(f.length) || t && f.length !== n.length ? !1 : n.every(function(i, c) {
|
|
123
|
-
try {
|
|
124
|
-
return a(i, f[c], t);
|
|
125
|
-
} catch (o) {
|
|
126
|
-
throw v(o, c);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return r.toJSON = function() {
|
|
131
|
-
return "(" + n.map(h).join(", ") + ")";
|
|
132
|
-
}, r;
|
|
133
|
-
},
|
|
134
|
-
value: function(n) {
|
|
135
|
-
function r(f) {
|
|
136
|
-
return f === n;
|
|
137
|
-
}
|
|
138
|
-
return r.toJSON = function() {
|
|
139
|
-
return n;
|
|
140
|
-
}, r;
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
g.oneOf = g.anyOf;
|
|
144
|
-
function l(e) {
|
|
145
|
-
if (u.String(e))
|
|
146
|
-
return e[0] === "?" ? g.maybe(e.slice(1)) : u[e] || g.quacksLike(e);
|
|
147
|
-
if (e && u.Object(e)) {
|
|
148
|
-
if (u.Array(e)) {
|
|
149
|
-
if (e.length !== 1) throw new TypeError("Expected compile() parameter of type Array of length 1");
|
|
150
|
-
return g.arrayOf(e[0]);
|
|
151
|
-
}
|
|
152
|
-
return g.object(e);
|
|
153
|
-
} else if (u.Function(e))
|
|
154
|
-
return e;
|
|
155
|
-
return g.value(e);
|
|
156
|
-
}
|
|
157
|
-
function a(e, n, r, f) {
|
|
158
|
-
if (u.Function(e)) {
|
|
159
|
-
if (e(n, r)) return !0;
|
|
160
|
-
throw new S(f || e, n);
|
|
161
|
-
}
|
|
162
|
-
return a(l(e), n, r);
|
|
163
|
-
}
|
|
164
|
-
for (var m in u)
|
|
165
|
-
a[m] = u[m];
|
|
166
|
-
for (m in g)
|
|
167
|
-
a[m] = g[m];
|
|
168
|
-
var s = w();
|
|
169
|
-
for (m in s)
|
|
170
|
-
a[m] = s[m];
|
|
171
|
-
a.compile = l;
|
|
172
|
-
a.TfTypeError = S;
|
|
173
|
-
a.TfPropertyTypeError = E;
|
|
174
|
-
var x = a;
|
|
175
|
-
export {
|
|
176
|
-
x as t
|
|
177
|
-
};
|
package/dist/index44.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
|
package/dist/index44.js
DELETED
package/dist/index45.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index59.cjs");require("./index60.cjs");const p=require("./index61.cjs");/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(m,a){var n=p.__exports,r=n.Buffer;function i(e,o){for(var t in e)o[t]=e[t]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?m.exports=n:(i(n,a),a.Buffer=f);function f(e,o,t){return r(e,o,t)}f.prototype=Object.create(r.prototype),i(r,f),f.from=function(e,o,t){if(typeof e=="number")throw new TypeError("Argument must not be a number");return r(e,o,t)},f.alloc=function(e,o,t){if(typeof e!="number")throw new TypeError("Argument must be a number");var u=r(e);return o!==void 0?typeof t=="string"?u.fill(o,t):u.fill(o):u.fill(0),u},f.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return r(e)},f.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}})(l.__module,l.__module.exports);var s=l.__module.exports;exports.safeBufferExports=s;
|
package/dist/index45.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { __module as a } from "./index59.js";
|
|
2
|
-
import "./index60.js";
|
|
3
|
-
import { __exports as s } from "./index61.js";
|
|
4
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
5
|
-
(function(l, m) {
|
|
6
|
-
var n = s, e = n.Buffer;
|
|
7
|
-
function p(r, f) {
|
|
8
|
-
for (var o in r)
|
|
9
|
-
f[o] = r[o];
|
|
10
|
-
}
|
|
11
|
-
e.from && e.alloc && e.allocUnsafe && e.allocUnsafeSlow ? l.exports = n : (p(n, m), m.Buffer = t);
|
|
12
|
-
function t(r, f, o) {
|
|
13
|
-
return e(r, f, o);
|
|
14
|
-
}
|
|
15
|
-
t.prototype = Object.create(e.prototype), p(e, t), t.from = function(r, f, o) {
|
|
16
|
-
if (typeof r == "number")
|
|
17
|
-
throw new TypeError("Argument must not be a number");
|
|
18
|
-
return e(r, f, o);
|
|
19
|
-
}, t.alloc = function(r, f, o) {
|
|
20
|
-
if (typeof r != "number")
|
|
21
|
-
throw new TypeError("Argument must be a number");
|
|
22
|
-
var u = e(r);
|
|
23
|
-
return f !== void 0 ? typeof o == "string" ? u.fill(f, o) : u.fill(f) : u.fill(0), u;
|
|
24
|
-
}, t.allocUnsafe = function(r) {
|
|
25
|
-
if (typeof r != "number")
|
|
26
|
-
throw new TypeError("Argument must be a number");
|
|
27
|
-
return e(r);
|
|
28
|
-
}, t.allocUnsafeSlow = function(r) {
|
|
29
|
-
if (typeof r != "number")
|
|
30
|
-
throw new TypeError("Argument must be a number");
|
|
31
|
-
return n.SlowBuffer(r);
|
|
32
|
-
};
|
|
33
|
-
})(a, a.exports);
|
|
34
|
-
var w = a.exports;
|
|
35
|
-
export {
|
|
36
|
-
w as s
|
|
37
|
-
};
|
package/dist/index46.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index57.cjs"),t=require("./index58.cjs");var e=a.browser,c=t.base;function b(r){var s=e("sha256").update(r).digest();return e("sha256").update(s).digest()}var o=c(b);exports.bs58check=o;
|
package/dist/index46.js
DELETED
package/dist/index47.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index66.cjs");class r extends s.BaseError{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}exports.InvalidAddressError=r;
|
package/dist/index47.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseError as r } from "./index66.js";
|
|
2
|
-
class d extends r {
|
|
3
|
-
constructor({ address: s }) {
|
|
4
|
-
super(`Address "${s}" is invalid.`, {
|
|
5
|
-
metaMessages: [
|
|
6
|
-
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
7
|
-
"- Address must match its checksum counterpart."
|
|
8
|
-
],
|
|
9
|
-
name: "InvalidAddressError"
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
d as InvalidAddressError
|
|
15
|
-
};
|
package/dist/index48.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index80.cjs"),i=require("./index81.cjs"),o=/^0x[a-fA-F0-9]{40}$/,t=new c.LruMap(8192);function f(e,n){const{strict:s=!0}=n??{},r=`${e}.${s}`;if(t.has(r))return t.get(r);const u=o.test(e)?e.toLowerCase()===e?!0:s?i.checksumAddress(e)===e:!0:!1;return t.set(r,u),u}exports.isAddress=f;exports.isAddressCache=t;
|
package/dist/index48.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LruMap as u } from "./index80.js";
|
|
2
|
-
import { checksumAddress as c } from "./index81.js";
|
|
3
|
-
const i = /^0x[a-fA-F0-9]{40}$/, r = /* @__PURE__ */ new u(8192);
|
|
4
|
-
function h(t, s) {
|
|
5
|
-
const { strict: n = !0 } = s ?? {}, e = `${t}.${n}`;
|
|
6
|
-
if (r.has(e))
|
|
7
|
-
return r.get(e);
|
|
8
|
-
const o = i.test(t) ? t.toLowerCase() === t ? !0 : n ? c(t) === t : !0 : !1;
|
|
9
|
-
return r.set(e, o), o;
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
h as isAddress,
|
|
13
|
-
r as isAddressCache
|
|
14
|
-
};
|
package/dist/index49.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e){return`0x${e.reduce((t,c)=>t+c.replace("0x",""),"")}`}exports.concatHex=r;
|
package/dist/index49.js
DELETED
package/dist/index5.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@gardenfi/utils"),f=require("viem"),r=require("@catalogfi/utils"),w=require("./index13.cjs");class g{constructor(t,o,e){this.url=new i.Url("/relayer",o),this.auth=e,this.order=t}async init(t){if(!t.account)return r.Err("No account found");if(t.account.address.toLowerCase()!==this.order.source_swap.initiator.toLowerCase())return r.Err("Account address and order initiator mismatch");const{create_order:o,source_swap:e}=this.order;if(!e.amount||!e.redeemer||!o.timelock||!o.secret_hash)return r.Err("Invalid order");const n=i.with0x(o.secret_hash),h=BigInt(o.timelock),p=i.with0x(e.redeemer),u=BigInt(e.amount);try{const a=await this.auth.getToken();if(a.error)return r.Err(a.error);const d=f.getContract({address:i.with0x(this.order.source_swap.asset),abi:w.AtomicSwapABI,client:t}),y=await d.read.token(),m=await i.checkAllowanceAndApprove(Number(u),y,this.order.source_swap.asset,t);if(m.error)return r.Err(m.error);const s=await d.read.eip712Domain(),l=await t.signTypedData({account:t.account,domain:{name:s[1],version:s[2],chainId:Number(s[3]),verifyingContract:s[4]},types:{Initiate:[{name:"redeemer",type:"address"},{name:"timelock",type:"uint256"},{name:"amount",type:"uint256"},{name:"secretHash",type:"bytes32"}]},primaryType:"Initiate",message:{redeemer:p,timelock:h,amount:u,secretHash:n}}),c=await r.Fetcher.post(this.url.endpoint("initiate"),{body:JSON.stringify({order_id:o.create_id,signature:l,perform_on:"Source"}),headers:{Authorization:i.Authorization(a.val),"Content-Type":"application/json"}});return c.error?r.Err(c.error):c.result?r.Ok(c.result):r.Err("Init: No result found")}catch(a){return console.log("init error :",a),r.Err(String(a))}}async redeem(t,o){try{const e=await this.auth.getToken();if(e.error)return r.Err(e.error);const n=await r.Fetcher.post(this.url.endpoint("redeem"),{body:JSON.stringify({order_id:t,secret:r.trim0x(o),perform_on:"Destination"}),headers:{Authorization:i.Authorization(e.val),"Content-Type":"application/json"}});return n.error?r.Err(n.error):n.result?r.Ok(n.result):r.Err("Redeem: No result found")}catch(e){return r.Err(String(e))}}}exports.EvmRelay=g;
|
package/dist/index5.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Url as _, with0x as c, checkAllowanceAndApprove as k, Authorization as p } from "@gardenfi/utils";
|
|
2
|
-
import { getContract as A } from "viem";
|
|
3
|
-
import { Err as e, Fetcher as h, Ok as y, trim0x as v } from "@catalogfi/utils";
|
|
4
|
-
import { AtomicSwapABI as I } from "./index13.js";
|
|
5
|
-
class z {
|
|
6
|
-
constructor(t, o, r) {
|
|
7
|
-
this.url = new _("/relayer", o), this.auth = r, this.order = t;
|
|
8
|
-
}
|
|
9
|
-
async init(t) {
|
|
10
|
-
if (!t.account) return e("No account found");
|
|
11
|
-
if (t.account.address.toLowerCase() !== this.order.source_swap.initiator.toLowerCase())
|
|
12
|
-
return e("Account address and order initiator mismatch");
|
|
13
|
-
const { create_order: o, source_swap: r } = this.order;
|
|
14
|
-
if (!r.amount || !r.redeemer || !o.timelock || !o.secret_hash)
|
|
15
|
-
return e("Invalid order");
|
|
16
|
-
const n = c(o.secret_hash), f = BigInt(o.timelock), g = c(r.redeemer), u = BigInt(r.amount);
|
|
17
|
-
try {
|
|
18
|
-
const a = await this.auth.getToken();
|
|
19
|
-
if (a.error) return e(a.error);
|
|
20
|
-
const d = A({
|
|
21
|
-
address: c(this.order.source_swap.asset),
|
|
22
|
-
abi: I,
|
|
23
|
-
client: t
|
|
24
|
-
}), w = await d.read.token(), m = await k(
|
|
25
|
-
Number(u),
|
|
26
|
-
w,
|
|
27
|
-
this.order.source_swap.asset,
|
|
28
|
-
t
|
|
29
|
-
);
|
|
30
|
-
if (m.error) return e(m.error);
|
|
31
|
-
const i = await d.read.eip712Domain(), l = await t.signTypedData({
|
|
32
|
-
account: t.account,
|
|
33
|
-
domain: {
|
|
34
|
-
name: i[1],
|
|
35
|
-
version: i[2],
|
|
36
|
-
chainId: Number(i[3]),
|
|
37
|
-
verifyingContract: i[4]
|
|
38
|
-
},
|
|
39
|
-
types: {
|
|
40
|
-
Initiate: [
|
|
41
|
-
{ name: "redeemer", type: "address" },
|
|
42
|
-
{ name: "timelock", type: "uint256" },
|
|
43
|
-
{ name: "amount", type: "uint256" },
|
|
44
|
-
{ name: "secretHash", type: "bytes32" }
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
primaryType: "Initiate",
|
|
48
|
-
message: {
|
|
49
|
-
redeemer: g,
|
|
50
|
-
timelock: f,
|
|
51
|
-
amount: u,
|
|
52
|
-
secretHash: n
|
|
53
|
-
}
|
|
54
|
-
}), s = await h.post(
|
|
55
|
-
this.url.endpoint("initiate"),
|
|
56
|
-
{
|
|
57
|
-
body: JSON.stringify({
|
|
58
|
-
order_id: o.create_id,
|
|
59
|
-
signature: l,
|
|
60
|
-
perform_on: "Source"
|
|
61
|
-
}),
|
|
62
|
-
headers: {
|
|
63
|
-
Authorization: p(a.val),
|
|
64
|
-
"Content-Type": "application/json"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
return s.error ? e(s.error) : s.result ? y(s.result) : e("Init: No result found");
|
|
69
|
-
} catch (a) {
|
|
70
|
-
return console.log("init error :", a), e(String(a));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
async redeem(t, o) {
|
|
74
|
-
try {
|
|
75
|
-
const r = await this.auth.getToken();
|
|
76
|
-
if (r.error) return e(r.error);
|
|
77
|
-
const n = await h.post(
|
|
78
|
-
this.url.endpoint("redeem"),
|
|
79
|
-
{
|
|
80
|
-
body: JSON.stringify({
|
|
81
|
-
order_id: t,
|
|
82
|
-
secret: v(o),
|
|
83
|
-
perform_on: "Destination"
|
|
84
|
-
}),
|
|
85
|
-
headers: {
|
|
86
|
-
Authorization: p(r.val),
|
|
87
|
-
"Content-Type": "application/json"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
return n.error ? e(n.error) : n.result ? y(n.result) : e("Redeem: No result found");
|
|
92
|
-
} catch (r) {
|
|
93
|
-
return e(String(r));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
export {
|
|
98
|
-
z as EvmRelay
|
|
99
|
-
};
|
package/dist/index50.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index53.cjs"),f=require("./index68.cjs"),x=require("./index39.cjs"),z=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function H(e,n={}){return typeof e=="number"||typeof e=="bigint"?d(e,n):typeof e=="string"?m(e,n):typeof e=="boolean"?b(e,n):u(e,n)}function b(e,n={}){const t=`0x${Number(e)}`;return typeof n.size=="number"?(x.assertSize(t,{size:n.size}),f.pad(t,{size:n.size})):t}function u(e,n={}){let t="";for(let i=0;i<e.length;i++)t+=z[e[i]];const r=`0x${t}`;return typeof n.size=="number"?(x.assertSize(r,{size:n.size}),f.pad(r,{dir:"right",size:n.size})):r}function d(e,n={}){const{signed:t,size:r}=n,i=BigInt(e);let o;r?t?o=(1n<<BigInt(r)*8n-1n)-1n:o=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const c=typeof o=="bigint"&&t?-o-1n:0;if(o&&i>o||i<c){const s=typeof e=="bigint"?"n":"";throw new y.IntegerOutOfRangeError({max:o?`${o}${s}`:void 0,min:`${c}${s}`,signed:t,size:r,value:`${e}${s}`})}const g=`0x${(t&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?f.pad(g,{size:r}):g}const T=new TextEncoder;function m(e,n={}){const t=T.encode(e);return u(t,n)}exports.boolToHex=b;exports.bytesToHex=u;exports.numberToHex=d;exports.stringToHex=m;exports.toHex=H;
|
package/dist/index50.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { IntegerOutOfRangeError as x } from "./index53.js";
|
|
2
|
-
import { pad as s } from "./index68.js";
|
|
3
|
-
import { assertSize as c } from "./index39.js";
|
|
4
|
-
const b = /* @__PURE__ */ Array.from({ length: 256 }, (n, e) => e.toString(16).padStart(2, "0"));
|
|
5
|
-
function B(n, e = {}) {
|
|
6
|
-
return typeof n == "number" || typeof n == "bigint" ? y(n, e) : typeof n == "string" ? $(n, e) : typeof n == "boolean" ? z(n, e) : m(n, e);
|
|
7
|
-
}
|
|
8
|
-
function z(n, e = {}) {
|
|
9
|
-
const t = `0x${Number(n)}`;
|
|
10
|
-
return typeof e.size == "number" ? (c(t, { size: e.size }), s(t, { size: e.size })) : t;
|
|
11
|
-
}
|
|
12
|
-
function m(n, e = {}) {
|
|
13
|
-
let t = "";
|
|
14
|
-
for (let i = 0; i < n.length; i++)
|
|
15
|
-
t += b[n[i]];
|
|
16
|
-
const r = `0x${t}`;
|
|
17
|
-
return typeof e.size == "number" ? (c(r, { size: e.size }), s(r, { dir: "right", size: e.size })) : r;
|
|
18
|
-
}
|
|
19
|
-
function y(n, e = {}) {
|
|
20
|
-
const { signed: t, size: r } = e, i = BigInt(n);
|
|
21
|
-
let o;
|
|
22
|
-
r ? t ? o = (1n << BigInt(r) * 8n - 1n) - 1n : o = 2n ** (BigInt(r) * 8n) - 1n : typeof n == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
|
|
23
|
-
const g = typeof o == "bigint" && t ? -o - 1n : 0;
|
|
24
|
-
if (o && i > o || i < g) {
|
|
25
|
-
const f = typeof n == "bigint" ? "n" : "";
|
|
26
|
-
throw new x({
|
|
27
|
-
max: o ? `${o}${f}` : void 0,
|
|
28
|
-
min: `${g}${f}`,
|
|
29
|
-
signed: t,
|
|
30
|
-
size: r,
|
|
31
|
-
value: `${n}${f}`
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const u = `0x${(t && i < 0 ? (1n << BigInt(r * 8)) + BigInt(i) : i).toString(16)}`;
|
|
35
|
-
return r ? s(u, { size: r }) : u;
|
|
36
|
-
}
|
|
37
|
-
const d = /* @__PURE__ */ new TextEncoder();
|
|
38
|
-
function $(n, e = {}) {
|
|
39
|
-
const t = d.encode(n);
|
|
40
|
-
return m(t, e);
|
|
41
|
-
}
|
|
42
|
-
export {
|
|
43
|
-
z as boolToHex,
|
|
44
|
-
m as bytesToHex,
|
|
45
|
-
y as numberToHex,
|
|
46
|
-
$ as stringToHex,
|
|
47
|
-
B as toHex
|
|
48
|
-
};
|
package/dist/index51.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index66.cjs"),u=require("./index69.cjs"),f=require("./index65.cjs"),g=require("./index50.cjs");function c(n,e="hex"){const i=o(n),s=u.createCursor(new Uint8Array(i.length));return i.encode(s),e==="hex"?g.bytesToHex(s.bytes):s.bytes}function o(n){return Array.isArray(n)?p(n.map(e=>o(e))):y(n)}function p(n){const e=n.reduce((t,h)=>t+h.length,0),i=l(e);return{length:e<=55?1+e:1+i+e,encode(t){e<=55?t.pushByte(192+e):(t.pushByte(247+i),i===1?t.pushUint8(e):i===2?t.pushUint16(e):i===3?t.pushUint24(e):t.pushUint32(e));for(const{encode:h}of n)h(t)}}}function y(n){const e=typeof n=="string"?f.hexToBytes(n):n,i=l(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+i+e.length,encode(t){e.length===1&&e[0]<128?t.pushBytes(e):e.length<=55?(t.pushByte(128+e.length),t.pushBytes(e)):(t.pushByte(183+i),i===1?t.pushUint8(e.length):i===2?t.pushUint16(e.length):i===3?t.pushUint24(e.length):t.pushUint32(e.length),t.pushBytes(e))}}}function l(n){if(n<2**8)return 1;if(n<2**16)return 2;if(n<2**24)return 3;if(n<2**32)return 4;throw new r.BaseError("Length is too large.")}exports.toRlp=c;
|