@chainflip/bitcoin 1.2.2 → 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.
- package/dist/index.cjs +283 -4
- package/dist/index.d.cts +36 -5
- package/dist/index.d.ts +36 -5
- package/dist/index.js +255 -0
- package/package.json +5 -15
- package/dist/address.cjs +0 -91
- package/dist/address.d.cts +0 -28
- package/dist/address.d.ts +0 -28
- package/dist/address.mjs +0 -91
- package/dist/consts.cjs +0 -12
- package/dist/consts.d.cts +0 -5
- package/dist/consts.d.ts +0 -5
- package/dist/consts.mjs +0 -12
- package/dist/deposit.cjs +0 -75
- package/dist/deposit.d.cts +0 -8
- package/dist/deposit.d.ts +0 -8
- package/dist/deposit.mjs +0 -75
- package/dist/index.mjs +0 -6
- package/dist/rpc.cjs +0 -75
- package/dist/rpc.d.cts +0 -166
- package/dist/rpc.d.ts +0 -166
- package/dist/rpc.mjs +0 -75
- package/dist/scale.cjs +0 -29
- package/dist/scale.d.cts +0 -22
- package/dist/scale.d.ts +0 -22
- package/dist/scale.mjs +0 -29
package/dist/rpc.d.cts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
type RpcRequest = {
|
|
4
|
-
getrawtransaction: [txId: string, enhanced?: boolean];
|
|
5
|
-
getblock: [blockHash: string, enhanced?: boolean];
|
|
6
|
-
};
|
|
7
|
-
declare const responseSchemas: {
|
|
8
|
-
readonly getrawtransaction: z.ZodObject<{
|
|
9
|
-
vout: z.ZodTuple<[z.ZodIntersection<z.ZodObject<{
|
|
10
|
-
scriptPubKey: z.ZodObject<{
|
|
11
|
-
type: z.ZodEnum<["witness_v1_taproot", "witness_v0_scripthash", "witness_v0_keyhash", "pubkeyhash", "scripthash"]>;
|
|
12
|
-
address: z.ZodString;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
15
|
-
address: string;
|
|
16
|
-
}, {
|
|
17
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
18
|
-
address: string;
|
|
19
|
-
}>;
|
|
20
|
-
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
scriptPubKey: {
|
|
22
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
23
|
-
address: string;
|
|
24
|
-
};
|
|
25
|
-
}, {
|
|
26
|
-
scriptPubKey: {
|
|
27
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
28
|
-
address: string;
|
|
29
|
-
};
|
|
30
|
-
}>, z.ZodObject<{
|
|
31
|
-
value: z.ZodEffects<z.ZodNumber, bigint, number>;
|
|
32
|
-
n: z.ZodNumber;
|
|
33
|
-
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
value: bigint;
|
|
35
|
-
n: number;
|
|
36
|
-
}, {
|
|
37
|
-
value: number;
|
|
38
|
-
n: number;
|
|
39
|
-
}>>, z.ZodIntersection<z.ZodObject<{
|
|
40
|
-
scriptPubKey: z.ZodObject<{
|
|
41
|
-
type: z.ZodLiteral<"nulldata">;
|
|
42
|
-
hex: z.ZodEffects<z.ZodString, Uint8Array<ArrayBufferLike>, string>;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
type: "nulldata";
|
|
45
|
-
hex: Uint8Array<ArrayBufferLike>;
|
|
46
|
-
}, {
|
|
47
|
-
type: "nulldata";
|
|
48
|
-
hex: string;
|
|
49
|
-
}>;
|
|
50
|
-
}, "strip", z.ZodTypeAny, {
|
|
51
|
-
scriptPubKey: {
|
|
52
|
-
type: "nulldata";
|
|
53
|
-
hex: Uint8Array<ArrayBufferLike>;
|
|
54
|
-
};
|
|
55
|
-
}, {
|
|
56
|
-
scriptPubKey: {
|
|
57
|
-
type: "nulldata";
|
|
58
|
-
hex: string;
|
|
59
|
-
};
|
|
60
|
-
}>, z.ZodObject<{
|
|
61
|
-
value: z.ZodEffects<z.ZodNumber, bigint, number>;
|
|
62
|
-
n: z.ZodNumber;
|
|
63
|
-
}, "strip", z.ZodTypeAny, {
|
|
64
|
-
value: bigint;
|
|
65
|
-
n: number;
|
|
66
|
-
}, {
|
|
67
|
-
value: number;
|
|
68
|
-
n: number;
|
|
69
|
-
}>>, z.ZodIntersection<z.ZodObject<{
|
|
70
|
-
scriptPubKey: z.ZodObject<{
|
|
71
|
-
type: z.ZodEnum<["witness_v1_taproot", "witness_v0_scripthash", "witness_v0_keyhash", "pubkeyhash", "scripthash"]>;
|
|
72
|
-
address: z.ZodString;
|
|
73
|
-
}, "strip", z.ZodTypeAny, {
|
|
74
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
75
|
-
address: string;
|
|
76
|
-
}, {
|
|
77
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
78
|
-
address: string;
|
|
79
|
-
}>;
|
|
80
|
-
}, "strip", z.ZodTypeAny, {
|
|
81
|
-
scriptPubKey: {
|
|
82
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
83
|
-
address: string;
|
|
84
|
-
};
|
|
85
|
-
}, {
|
|
86
|
-
scriptPubKey: {
|
|
87
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
88
|
-
address: string;
|
|
89
|
-
};
|
|
90
|
-
}>, z.ZodObject<{
|
|
91
|
-
value: z.ZodEffects<z.ZodNumber, bigint, number>;
|
|
92
|
-
n: z.ZodNumber;
|
|
93
|
-
}, "strip", z.ZodTypeAny, {
|
|
94
|
-
value: bigint;
|
|
95
|
-
n: number;
|
|
96
|
-
}, {
|
|
97
|
-
value: number;
|
|
98
|
-
n: number;
|
|
99
|
-
}>>], null>;
|
|
100
|
-
blockhash: z.ZodString;
|
|
101
|
-
}, "strip", z.ZodTypeAny, {
|
|
102
|
-
vout: [{
|
|
103
|
-
scriptPubKey: {
|
|
104
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
105
|
-
address: string;
|
|
106
|
-
};
|
|
107
|
-
} & {
|
|
108
|
-
value: bigint;
|
|
109
|
-
n: number;
|
|
110
|
-
}, {
|
|
111
|
-
scriptPubKey: {
|
|
112
|
-
type: "nulldata";
|
|
113
|
-
hex: Uint8Array<ArrayBufferLike>;
|
|
114
|
-
};
|
|
115
|
-
} & {
|
|
116
|
-
value: bigint;
|
|
117
|
-
n: number;
|
|
118
|
-
}, {
|
|
119
|
-
scriptPubKey: {
|
|
120
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
121
|
-
address: string;
|
|
122
|
-
};
|
|
123
|
-
} & {
|
|
124
|
-
value: bigint;
|
|
125
|
-
n: number;
|
|
126
|
-
}];
|
|
127
|
-
blockhash: string;
|
|
128
|
-
}, {
|
|
129
|
-
vout: [{
|
|
130
|
-
scriptPubKey: {
|
|
131
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
132
|
-
address: string;
|
|
133
|
-
};
|
|
134
|
-
} & {
|
|
135
|
-
value: number;
|
|
136
|
-
n: number;
|
|
137
|
-
}, {
|
|
138
|
-
scriptPubKey: {
|
|
139
|
-
type: "nulldata";
|
|
140
|
-
hex: string;
|
|
141
|
-
};
|
|
142
|
-
} & {
|
|
143
|
-
value: number;
|
|
144
|
-
n: number;
|
|
145
|
-
}, {
|
|
146
|
-
scriptPubKey: {
|
|
147
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
148
|
-
address: string;
|
|
149
|
-
};
|
|
150
|
-
} & {
|
|
151
|
-
value: number;
|
|
152
|
-
n: number;
|
|
153
|
-
}];
|
|
154
|
-
blockhash: string;
|
|
155
|
-
}>;
|
|
156
|
-
readonly getblock: z.ZodObject<{
|
|
157
|
-
height: z.ZodNumber;
|
|
158
|
-
}, "strip", z.ZodTypeAny, {
|
|
159
|
-
height: number;
|
|
160
|
-
}, {
|
|
161
|
-
height: number;
|
|
162
|
-
}>;
|
|
163
|
-
};
|
|
164
|
-
declare const makeRequest: <T extends keyof RpcRequest & keyof typeof responseSchemas>(rpcUrl: string, method: T, params: RpcRequest[T]) => Promise<z.output<(typeof responseSchemas)[T]> | null>;
|
|
165
|
-
|
|
166
|
-
export { makeRequest };
|
package/dist/rpc.d.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
type RpcRequest = {
|
|
4
|
-
getrawtransaction: [txId: string, enhanced?: boolean];
|
|
5
|
-
getblock: [blockHash: string, enhanced?: boolean];
|
|
6
|
-
};
|
|
7
|
-
declare const responseSchemas: {
|
|
8
|
-
readonly getrawtransaction: z.ZodObject<{
|
|
9
|
-
vout: z.ZodTuple<[z.ZodIntersection<z.ZodObject<{
|
|
10
|
-
scriptPubKey: z.ZodObject<{
|
|
11
|
-
type: z.ZodEnum<["witness_v1_taproot", "witness_v0_scripthash", "witness_v0_keyhash", "pubkeyhash", "scripthash"]>;
|
|
12
|
-
address: z.ZodString;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
15
|
-
address: string;
|
|
16
|
-
}, {
|
|
17
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
18
|
-
address: string;
|
|
19
|
-
}>;
|
|
20
|
-
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
scriptPubKey: {
|
|
22
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
23
|
-
address: string;
|
|
24
|
-
};
|
|
25
|
-
}, {
|
|
26
|
-
scriptPubKey: {
|
|
27
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
28
|
-
address: string;
|
|
29
|
-
};
|
|
30
|
-
}>, z.ZodObject<{
|
|
31
|
-
value: z.ZodEffects<z.ZodNumber, bigint, number>;
|
|
32
|
-
n: z.ZodNumber;
|
|
33
|
-
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
value: bigint;
|
|
35
|
-
n: number;
|
|
36
|
-
}, {
|
|
37
|
-
value: number;
|
|
38
|
-
n: number;
|
|
39
|
-
}>>, z.ZodIntersection<z.ZodObject<{
|
|
40
|
-
scriptPubKey: z.ZodObject<{
|
|
41
|
-
type: z.ZodLiteral<"nulldata">;
|
|
42
|
-
hex: z.ZodEffects<z.ZodString, Uint8Array<ArrayBufferLike>, string>;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
type: "nulldata";
|
|
45
|
-
hex: Uint8Array<ArrayBufferLike>;
|
|
46
|
-
}, {
|
|
47
|
-
type: "nulldata";
|
|
48
|
-
hex: string;
|
|
49
|
-
}>;
|
|
50
|
-
}, "strip", z.ZodTypeAny, {
|
|
51
|
-
scriptPubKey: {
|
|
52
|
-
type: "nulldata";
|
|
53
|
-
hex: Uint8Array<ArrayBufferLike>;
|
|
54
|
-
};
|
|
55
|
-
}, {
|
|
56
|
-
scriptPubKey: {
|
|
57
|
-
type: "nulldata";
|
|
58
|
-
hex: string;
|
|
59
|
-
};
|
|
60
|
-
}>, z.ZodObject<{
|
|
61
|
-
value: z.ZodEffects<z.ZodNumber, bigint, number>;
|
|
62
|
-
n: z.ZodNumber;
|
|
63
|
-
}, "strip", z.ZodTypeAny, {
|
|
64
|
-
value: bigint;
|
|
65
|
-
n: number;
|
|
66
|
-
}, {
|
|
67
|
-
value: number;
|
|
68
|
-
n: number;
|
|
69
|
-
}>>, z.ZodIntersection<z.ZodObject<{
|
|
70
|
-
scriptPubKey: z.ZodObject<{
|
|
71
|
-
type: z.ZodEnum<["witness_v1_taproot", "witness_v0_scripthash", "witness_v0_keyhash", "pubkeyhash", "scripthash"]>;
|
|
72
|
-
address: z.ZodString;
|
|
73
|
-
}, "strip", z.ZodTypeAny, {
|
|
74
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
75
|
-
address: string;
|
|
76
|
-
}, {
|
|
77
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
78
|
-
address: string;
|
|
79
|
-
}>;
|
|
80
|
-
}, "strip", z.ZodTypeAny, {
|
|
81
|
-
scriptPubKey: {
|
|
82
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
83
|
-
address: string;
|
|
84
|
-
};
|
|
85
|
-
}, {
|
|
86
|
-
scriptPubKey: {
|
|
87
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
88
|
-
address: string;
|
|
89
|
-
};
|
|
90
|
-
}>, z.ZodObject<{
|
|
91
|
-
value: z.ZodEffects<z.ZodNumber, bigint, number>;
|
|
92
|
-
n: z.ZodNumber;
|
|
93
|
-
}, "strip", z.ZodTypeAny, {
|
|
94
|
-
value: bigint;
|
|
95
|
-
n: number;
|
|
96
|
-
}, {
|
|
97
|
-
value: number;
|
|
98
|
-
n: number;
|
|
99
|
-
}>>], null>;
|
|
100
|
-
blockhash: z.ZodString;
|
|
101
|
-
}, "strip", z.ZodTypeAny, {
|
|
102
|
-
vout: [{
|
|
103
|
-
scriptPubKey: {
|
|
104
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
105
|
-
address: string;
|
|
106
|
-
};
|
|
107
|
-
} & {
|
|
108
|
-
value: bigint;
|
|
109
|
-
n: number;
|
|
110
|
-
}, {
|
|
111
|
-
scriptPubKey: {
|
|
112
|
-
type: "nulldata";
|
|
113
|
-
hex: Uint8Array<ArrayBufferLike>;
|
|
114
|
-
};
|
|
115
|
-
} & {
|
|
116
|
-
value: bigint;
|
|
117
|
-
n: number;
|
|
118
|
-
}, {
|
|
119
|
-
scriptPubKey: {
|
|
120
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
121
|
-
address: string;
|
|
122
|
-
};
|
|
123
|
-
} & {
|
|
124
|
-
value: bigint;
|
|
125
|
-
n: number;
|
|
126
|
-
}];
|
|
127
|
-
blockhash: string;
|
|
128
|
-
}, {
|
|
129
|
-
vout: [{
|
|
130
|
-
scriptPubKey: {
|
|
131
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
132
|
-
address: string;
|
|
133
|
-
};
|
|
134
|
-
} & {
|
|
135
|
-
value: number;
|
|
136
|
-
n: number;
|
|
137
|
-
}, {
|
|
138
|
-
scriptPubKey: {
|
|
139
|
-
type: "nulldata";
|
|
140
|
-
hex: string;
|
|
141
|
-
};
|
|
142
|
-
} & {
|
|
143
|
-
value: number;
|
|
144
|
-
n: number;
|
|
145
|
-
}, {
|
|
146
|
-
scriptPubKey: {
|
|
147
|
-
type: "witness_v1_taproot" | "witness_v0_scripthash" | "witness_v0_keyhash" | "pubkeyhash" | "scripthash";
|
|
148
|
-
address: string;
|
|
149
|
-
};
|
|
150
|
-
} & {
|
|
151
|
-
value: number;
|
|
152
|
-
n: number;
|
|
153
|
-
}];
|
|
154
|
-
blockhash: string;
|
|
155
|
-
}>;
|
|
156
|
-
readonly getblock: z.ZodObject<{
|
|
157
|
-
height: z.ZodNumber;
|
|
158
|
-
}, "strip", z.ZodTypeAny, {
|
|
159
|
-
height: number;
|
|
160
|
-
}, {
|
|
161
|
-
height: number;
|
|
162
|
-
}>;
|
|
163
|
-
};
|
|
164
|
-
declare const makeRequest: <T extends keyof RpcRequest & keyof typeof responseSchemas>(rpcUrl: string, method: T, params: RpcRequest[T]) => Promise<z.output<(typeof responseSchemas)[T]> | null>;
|
|
165
|
-
|
|
166
|
-
export { makeRequest };
|
package/dist/rpc.mjs
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// src/rpc.ts
|
|
2
|
-
import { hexToBytes } from "@chainflip/utils/bytes";
|
|
3
|
-
import { parseUrlWithBasicAuth } from "@chainflip/utils/url";
|
|
4
|
-
import BigNumber from "bignumber.js";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
var hexString = z.string().regex(/^([0-9a-f]{2})+$/, { message: "expected hex string" });
|
|
7
|
-
var vout = z.object({
|
|
8
|
-
value: z.number().transform((n) => BigInt(new BigNumber(n).shiftedBy(8).toFixed(0))),
|
|
9
|
-
n: z.number()
|
|
10
|
-
});
|
|
11
|
-
var nulldataVout = z.object({
|
|
12
|
-
scriptPubKey: z.object({
|
|
13
|
-
type: z.literal("nulldata"),
|
|
14
|
-
// remove OP_RETURN and PUSH_BYTES_XX
|
|
15
|
-
hex: hexString.transform((x) => hexToBytes(`0x${x.slice(4)}`))
|
|
16
|
-
})
|
|
17
|
-
}).and(vout);
|
|
18
|
-
var addressVout = z.object({
|
|
19
|
-
scriptPubKey: z.object({
|
|
20
|
-
type: z.enum([
|
|
21
|
-
"witness_v1_taproot",
|
|
22
|
-
"witness_v0_scripthash",
|
|
23
|
-
"witness_v0_keyhash",
|
|
24
|
-
"pubkeyhash",
|
|
25
|
-
"scripthash"
|
|
26
|
-
]),
|
|
27
|
-
address: z.string()
|
|
28
|
-
})
|
|
29
|
-
}).and(vout);
|
|
30
|
-
var txSchema = z.object({
|
|
31
|
-
vout: z.tuple([addressVout, nulldataVout, addressVout]),
|
|
32
|
-
blockhash: hexString
|
|
33
|
-
});
|
|
34
|
-
var blockSchema = z.object({
|
|
35
|
-
height: z.number()
|
|
36
|
-
});
|
|
37
|
-
var responseSchemas = {
|
|
38
|
-
getrawtransaction: txSchema,
|
|
39
|
-
getblock: blockSchema
|
|
40
|
-
};
|
|
41
|
-
var rpcResponse = z.union([
|
|
42
|
-
z.object({ result: z.null(), error: z.object({ code: z.number(), message: z.string() }) }),
|
|
43
|
-
z.object({ result: z.unknown(), error: z.null() })
|
|
44
|
-
]);
|
|
45
|
-
var makeRequest = async (rpcUrl, method, params) => {
|
|
46
|
-
const { url, headers } = parseUrlWithBasicAuth(rpcUrl);
|
|
47
|
-
const res = await fetch(url, {
|
|
48
|
-
method: "POST",
|
|
49
|
-
headers: {
|
|
50
|
-
...headers,
|
|
51
|
-
"Content-Type": "application/json"
|
|
52
|
-
},
|
|
53
|
-
body: JSON.stringify({
|
|
54
|
-
jsonrpc: "2.0",
|
|
55
|
-
id: 1,
|
|
56
|
-
method,
|
|
57
|
-
params
|
|
58
|
-
})
|
|
59
|
-
});
|
|
60
|
-
const json = await res.json();
|
|
61
|
-
const result = rpcResponse.parse(json);
|
|
62
|
-
if (result.error) {
|
|
63
|
-
if (result.error.code === -5) return null;
|
|
64
|
-
throw new Error(`RPC error [${result.error.code}]: ${result.error.message}`);
|
|
65
|
-
}
|
|
66
|
-
const parseResult = responseSchemas[method].safeParse(result.result);
|
|
67
|
-
if (!parseResult.success) {
|
|
68
|
-
if (method === "getrawtransaction") return null;
|
|
69
|
-
throw parseResult.error;
|
|
70
|
-
}
|
|
71
|
-
return parseResult.data;
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
makeRequest
|
|
75
|
-
};
|
package/dist/scale.cjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/scale.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chainflip = require('@chainflip/utils/chainflip');
|
|
5
|
-
var _scalets = require('scale-ts');
|
|
6
|
-
var addressByteLengths = {
|
|
7
|
-
Bitcoin: void 0,
|
|
8
|
-
Arbitrum: 20,
|
|
9
|
-
Ethereum: 20,
|
|
10
|
-
Solana: 32,
|
|
11
|
-
Polkadot: 32
|
|
12
|
-
};
|
|
13
|
-
var createSwapDataCodec = (asset) => _scalets.Struct.call(void 0, {
|
|
14
|
-
version: _scalets.u8,
|
|
15
|
-
destinationAsset: _scalets.u8,
|
|
16
|
-
destinationAddress: _scalets.Bytes.call(void 0, addressByteLengths[_chainflip.assetConstants[asset].chain]),
|
|
17
|
-
parameters: _scalets.Struct.call(void 0, {
|
|
18
|
-
retryDuration: _scalets.u16,
|
|
19
|
-
minOutputAmount: _scalets.u128,
|
|
20
|
-
numberOfChunks: _scalets.u16,
|
|
21
|
-
chunkInterval: _scalets.u16,
|
|
22
|
-
boostFee: _scalets.u8,
|
|
23
|
-
brokerFee: _scalets.u8,
|
|
24
|
-
affiliates: _scalets.Vector.call(void 0, _scalets.Struct.call(void 0, { accountIndex: _scalets.u8, commissionBps: _scalets.u8 }))
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exports.createSwapDataCodec = createSwapDataCodec;
|
package/dist/scale.d.cts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as scale_ts from 'scale-ts';
|
|
2
|
-
import { ChainflipAsset } from '@chainflip/utils/chainflip';
|
|
3
|
-
|
|
4
|
-
declare const createSwapDataCodec: (asset: ChainflipAsset) => scale_ts.Codec<{
|
|
5
|
-
version: number;
|
|
6
|
-
destinationAsset: number;
|
|
7
|
-
destinationAddress: Uint8Array<ArrayBufferLike>;
|
|
8
|
-
parameters: {
|
|
9
|
-
retryDuration: number;
|
|
10
|
-
minOutputAmount: bigint;
|
|
11
|
-
numberOfChunks: number;
|
|
12
|
-
chunkInterval: number;
|
|
13
|
-
boostFee: number;
|
|
14
|
-
brokerFee: number;
|
|
15
|
-
affiliates: {
|
|
16
|
-
accountIndex: number;
|
|
17
|
-
commissionBps: number;
|
|
18
|
-
}[];
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
21
|
-
|
|
22
|
-
export { createSwapDataCodec };
|
package/dist/scale.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as scale_ts from 'scale-ts';
|
|
2
|
-
import { ChainflipAsset } from '@chainflip/utils/chainflip';
|
|
3
|
-
|
|
4
|
-
declare const createSwapDataCodec: (asset: ChainflipAsset) => scale_ts.Codec<{
|
|
5
|
-
version: number;
|
|
6
|
-
destinationAsset: number;
|
|
7
|
-
destinationAddress: Uint8Array<ArrayBufferLike>;
|
|
8
|
-
parameters: {
|
|
9
|
-
retryDuration: number;
|
|
10
|
-
minOutputAmount: bigint;
|
|
11
|
-
numberOfChunks: number;
|
|
12
|
-
chunkInterval: number;
|
|
13
|
-
boostFee: number;
|
|
14
|
-
brokerFee: number;
|
|
15
|
-
affiliates: {
|
|
16
|
-
accountIndex: number;
|
|
17
|
-
commissionBps: number;
|
|
18
|
-
}[];
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
21
|
-
|
|
22
|
-
export { createSwapDataCodec };
|
package/dist/scale.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// src/scale.ts
|
|
2
|
-
import {
|
|
3
|
-
assetConstants
|
|
4
|
-
} from "@chainflip/utils/chainflip";
|
|
5
|
-
import { Struct, Bytes, u16, u128, u8, Vector } from "scale-ts";
|
|
6
|
-
var addressByteLengths = {
|
|
7
|
-
Bitcoin: void 0,
|
|
8
|
-
Arbitrum: 20,
|
|
9
|
-
Ethereum: 20,
|
|
10
|
-
Solana: 32,
|
|
11
|
-
Polkadot: 32
|
|
12
|
-
};
|
|
13
|
-
var createSwapDataCodec = (asset) => Struct({
|
|
14
|
-
version: u8,
|
|
15
|
-
destinationAsset: u8,
|
|
16
|
-
destinationAddress: Bytes(addressByteLengths[assetConstants[asset].chain]),
|
|
17
|
-
parameters: Struct({
|
|
18
|
-
retryDuration: u16,
|
|
19
|
-
minOutputAmount: u128,
|
|
20
|
-
numberOfChunks: u16,
|
|
21
|
-
chunkInterval: u16,
|
|
22
|
-
boostFee: u8,
|
|
23
|
-
brokerFee: u8,
|
|
24
|
-
affiliates: Vector(Struct({ accountIndex: u8, commissionBps: u8 }))
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
export {
|
|
28
|
-
createSwapDataCodec
|
|
29
|
-
};
|