@autogames/sdk 1.1.1 → 1.2.4

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.
@@ -1,131 +0,0 @@
1
- import { K as b, bP as y, bD as w, a3 as x, bR as p, cd as z, ca as M, d6 as k, cc as f, d7 as P, X as T, d8 as $, a2 as E, d9 as N, bs as S, c6 as B, da as L } from "./bridge-mount-Bhf05oeO.js";
2
- function _(t, e) {
3
- if (t.length !== e.length)
4
- throw new b({
5
- expectedLength: t.length,
6
- givenLength: e.length
7
- });
8
- const i = [];
9
- for (let n = 0; n < t.length; n++) {
10
- const u = t[n], o = e[n];
11
- i.push(m(u, o));
12
- }
13
- return y(i);
14
- }
15
- function m(t, e, i = !1) {
16
- if (t === "address") {
17
- const r = e;
18
- if (!w(r))
19
- throw new x({ address: r });
20
- return p(r.toLowerCase(), {
21
- size: i ? 32 : null
22
- });
23
- }
24
- if (t === "string")
25
- return z(e);
26
- if (t === "bytes")
27
- return e;
28
- if (t === "bool")
29
- return p(M(e), { size: i ? 32 : 1 });
30
- const n = t.match(k);
31
- if (n) {
32
- const [r, s, a = "256"] = n, c = Number.parseInt(a, 10) / 8;
33
- return f(e, {
34
- size: i ? 32 : c,
35
- signed: s === "int"
36
- });
37
- }
38
- const u = t.match(P);
39
- if (u) {
40
- const [r, s] = u;
41
- if (Number.parseInt(s, 10) !== (e.length - 2) / 2)
42
- throw new T({
43
- expectedSize: Number.parseInt(s, 10),
44
- givenSize: (e.length - 2) / 2
45
- });
46
- return p(e, { dir: "right", size: i ? 32 : null });
47
- }
48
- const o = t.match($);
49
- if (o && Array.isArray(e)) {
50
- const [r, s] = o, a = [];
51
- for (let c = 0; c < e.length; c++)
52
- a.push(m(s, e[c], !0));
53
- return a.length === 0 ? "0x" : y(a);
54
- }
55
- throw new E(t);
56
- }
57
- function C(t) {
58
- return {
59
- formatters: void 0,
60
- fees: void 0,
61
- serializers: void 0,
62
- ...t
63
- };
64
- }
65
- function H(t) {
66
- const { source: e } = t, i = /* @__PURE__ */ new Map(), n = new N(8192), u = /* @__PURE__ */ new Map(), o = ({ address: r, chainId: s }) => `${r}.${s}`;
67
- return {
68
- async consume({ address: r, chainId: s, client: a }) {
69
- const c = o({ address: r, chainId: s }), d = this.get({ address: r, chainId: s, client: a });
70
- this.increment({ address: r, chainId: s });
71
- const g = await d;
72
- return await e.set({ address: r, chainId: s }, g), n.set(c, g), g;
73
- },
74
- async increment({ address: r, chainId: s }) {
75
- const a = o({ address: r, chainId: s }), c = i.get(a) ?? 0;
76
- i.set(a, c + 1);
77
- },
78
- async get({ address: r, chainId: s, client: a }) {
79
- const c = o({ address: r, chainId: s });
80
- let d = u.get(c);
81
- return d || (d = (async () => {
82
- try {
83
- const l = await e.get({ address: r, chainId: s, client: a }), h = n.get(c) ?? 0;
84
- return h > 0 && l <= h ? h + 1 : (n.delete(c), l);
85
- } finally {
86
- this.reset({ address: r, chainId: s });
87
- }
88
- })(), u.set(c, d)), (i.get(c) ?? 0) + await d;
89
- },
90
- reset({ address: r, chainId: s }) {
91
- const a = o({ address: r, chainId: s });
92
- i.delete(a), u.delete(a);
93
- }
94
- };
95
- }
96
- const A = "0x6492649264926492649264926492649264926492649264926492649264926492";
97
- function I(t) {
98
- const { address: e, data: i, signature: n, to: u = "hex" } = t, o = y([
99
- S([{ type: "address" }, { type: "bytes" }, { type: "bytes" }], [e, i, n]),
100
- A
101
- ]);
102
- return u === "hex" ? o : B(o);
103
- }
104
- function K(t) {
105
- const { r: e, s: i } = L.Signature.fromCompact(t.slice(2, 130)), n = +`0x${t.slice(130)}`, [u, o] = (() => {
106
- if (n === 0 || n === 1)
107
- return [void 0, n];
108
- if (n === 27)
109
- return [BigInt(n), 0];
110
- if (n === 28)
111
- return [BigInt(n), 1];
112
- throw new Error("Invalid yParityOrV value");
113
- })();
114
- return typeof u < "u" ? {
115
- r: f(e, { size: 32 }),
116
- s: f(i, { size: 32 }),
117
- v: u,
118
- yParity: o
119
- } : {
120
- r: f(e, { size: 32 }),
121
- s: f(i, { size: 32 }),
122
- yParity: o
123
- };
124
- }
125
- export {
126
- H as c,
127
- C as d,
128
- _ as e,
129
- K as p,
130
- I as s
131
- };