@chainflip/utils 0.4.16 → 0.5.0
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/base58.cjs +11 -1
- package/dist/base58.d.cts +3 -1
- package/dist/base58.d.ts +3 -1
- package/dist/base58.js +2 -2
- package/dist/bytes.cjs +2 -1
- package/dist/bytes.d.cts +2 -2
- package/dist/bytes.d.ts +2 -2
- package/dist/bytes.js +1 -1
- package/dist/{chunk-F4PFSMIC.js → chunk-HOUVS5DD.js} +1 -1
- package/dist/{chunk-2KA626OL.js → chunk-W23CNAUU.js} +2 -1
- package/dist/consts.cjs +6 -2
- package/dist/consts.js +6 -2
- package/dist/ss58.cjs +2 -1
- package/dist/ss58.d.cts +2 -2
- package/dist/ss58.d.ts +2 -2
- package/dist/ss58.js +2 -2
- package/dist/types.d.cts +2 -1
- package/dist/types.d.ts +2 -1
- package/package.json +1 -1
package/dist/base58.cjs
CHANGED
|
@@ -44,7 +44,17 @@ function assert(condition, message = "assertion failed", Constructor = Error) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// src/bytes.ts
|
|
47
|
-
var
|
|
47
|
+
var hexToBytes = (input) => {
|
|
48
|
+
assert(/^0x[\da-f]*$/i.test(input) && input.length % 2 === 0, "Invalid hex string");
|
|
49
|
+
const hex = input.slice(2);
|
|
50
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
51
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
52
|
+
bytes[i / 2] = Number.parseInt(hex.slice(i, i + 2), 16);
|
|
53
|
+
}
|
|
54
|
+
return bytes;
|
|
55
|
+
};
|
|
56
|
+
var convertBase = (inputBytes, fromBase, toBase) => {
|
|
57
|
+
const bytes = typeof inputBytes === "string" ? hexToBytes(inputBytes) : new Uint8Array(inputBytes);
|
|
48
58
|
const result = [];
|
|
49
59
|
for (const byte of bytes) {
|
|
50
60
|
let carry = byte;
|
package/dist/base58.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Bytelike } from './types.cjs';
|
|
2
|
+
|
|
1
3
|
declare const CHARSET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2
|
-
declare const encode: (bytes:
|
|
4
|
+
declare const encode: (bytes: Bytelike) => string;
|
|
3
5
|
declare const decode: (input: string) => Uint8Array;
|
|
4
6
|
|
|
5
7
|
export { CHARSET, decode, encode };
|
package/dist/base58.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Bytelike } from './types.js';
|
|
2
|
+
|
|
1
3
|
declare const CHARSET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
2
|
-
declare const encode: (bytes:
|
|
4
|
+
declare const encode: (bytes: Bytelike) => string;
|
|
3
5
|
declare const decode: (input: string) => Uint8Array;
|
|
4
6
|
|
|
5
7
|
export { CHARSET, decode, encode };
|
package/dist/base58.js
CHANGED
package/dist/bytes.cjs
CHANGED
|
@@ -59,7 +59,8 @@ var hexToBytes = (input) => {
|
|
|
59
59
|
}
|
|
60
60
|
return bytes;
|
|
61
61
|
};
|
|
62
|
-
var convertBase = (
|
|
62
|
+
var convertBase = (inputBytes, fromBase, toBase) => {
|
|
63
|
+
const bytes = typeof inputBytes === "string" ? hexToBytes(inputBytes) : new Uint8Array(inputBytes);
|
|
63
64
|
const result = [];
|
|
64
65
|
for (const byte of bytes) {
|
|
65
66
|
let carry = byte;
|
package/dist/bytes.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HexString } from './types.cjs';
|
|
1
|
+
import { HexString, Bytelike } from './types.cjs';
|
|
2
2
|
|
|
3
3
|
declare const bytesToHex: (input: Uint8Array | number[]) => `0x${string}`;
|
|
4
4
|
declare const hexToBytes: (input: HexString) => Uint8Array;
|
|
5
|
-
declare const encodeBytesWithCharset: (bytes:
|
|
5
|
+
declare const encodeBytesWithCharset: (bytes: Bytelike, charset: string) => string;
|
|
6
6
|
declare const decodeBytesWithCharset: (input: string, charset: string) => Uint8Array;
|
|
7
7
|
declare function reverseBytes(input: HexString): HexString;
|
|
8
8
|
declare function reverseBytes(input: string): string;
|
package/dist/bytes.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { HexString } from './types.js';
|
|
1
|
+
import { HexString, Bytelike } from './types.js';
|
|
2
2
|
|
|
3
3
|
declare const bytesToHex: (input: Uint8Array | number[]) => `0x${string}`;
|
|
4
4
|
declare const hexToBytes: (input: HexString) => Uint8Array;
|
|
5
|
-
declare const encodeBytesWithCharset: (bytes:
|
|
5
|
+
declare const encodeBytesWithCharset: (bytes: Bytelike, charset: string) => string;
|
|
6
6
|
declare const decodeBytesWithCharset: (input: string, charset: string) => Uint8Array;
|
|
7
7
|
declare function reverseBytes(input: HexString): HexString;
|
|
8
8
|
declare function reverseBytes(input: string): string;
|
package/dist/bytes.js
CHANGED
|
@@ -16,7 +16,8 @@ var hexToBytes = (input) => {
|
|
|
16
16
|
}
|
|
17
17
|
return bytes;
|
|
18
18
|
};
|
|
19
|
-
var convertBase = (
|
|
19
|
+
var convertBase = (inputBytes, fromBase, toBase) => {
|
|
20
|
+
const bytes = typeof inputBytes === "string" ? hexToBytes(inputBytes) : new Uint8Array(inputBytes);
|
|
20
21
|
const result = [];
|
|
21
22
|
for (const byte of bytes) {
|
|
22
23
|
let carry = byte;
|
package/dist/consts.cjs
CHANGED
|
@@ -41,14 +41,14 @@ var chainflipLinks = {
|
|
|
41
41
|
website: "https://chainflip.io/",
|
|
42
42
|
discord: "https://discord.gg/chainflip-community",
|
|
43
43
|
twitter: "https://twitter.com/chainflip",
|
|
44
|
-
telegram: "https://t.me/
|
|
44
|
+
telegram: "https://t.me/chainflip_io_chat",
|
|
45
45
|
blog: "https://blog.chainflip.io/",
|
|
46
46
|
docs: "https://docs.chainflip.io/"
|
|
47
47
|
};
|
|
48
48
|
var chainflipCommunityLinks = {
|
|
49
49
|
discord: "https://discord.gg/chainflip-community",
|
|
50
50
|
twitter: "https://twitter.com/chainflip",
|
|
51
|
-
telegram: "https://t.me/
|
|
51
|
+
telegram: "https://t.me/chainflip_io_chat"
|
|
52
52
|
};
|
|
53
53
|
var brokerAliasMap = {
|
|
54
54
|
cFLRQDfEdmnv6d2XfHJNRBQHi4fruPMReLSfvB8WWD2ENbqj7: {
|
|
@@ -128,6 +128,10 @@ var brokerAliasMap = {
|
|
|
128
128
|
cFL4To8Uow6B1hk4dNrhWhvKpkBtnUTrVdWCEKCaXiXMMztjM: {
|
|
129
129
|
name: "SwapKit",
|
|
130
130
|
twitter: "@SwapKitPowered"
|
|
131
|
+
},
|
|
132
|
+
cFKe4xhoVd783CUTYNxMua4eVE3pSDnbvjLXVRpeq2qC9bSZi: {
|
|
133
|
+
name: "Cake Wallet",
|
|
134
|
+
twitter: "@cakewallet"
|
|
131
135
|
}
|
|
132
136
|
};
|
|
133
137
|
var lpAliasMap = {
|
package/dist/consts.js
CHANGED
|
@@ -8,14 +8,14 @@ var chainflipLinks = {
|
|
|
8
8
|
website: "https://chainflip.io/",
|
|
9
9
|
discord: "https://discord.gg/chainflip-community",
|
|
10
10
|
twitter: "https://twitter.com/chainflip",
|
|
11
|
-
telegram: "https://t.me/
|
|
11
|
+
telegram: "https://t.me/chainflip_io_chat",
|
|
12
12
|
blog: "https://blog.chainflip.io/",
|
|
13
13
|
docs: "https://docs.chainflip.io/"
|
|
14
14
|
};
|
|
15
15
|
var chainflipCommunityLinks = {
|
|
16
16
|
discord: "https://discord.gg/chainflip-community",
|
|
17
17
|
twitter: "https://twitter.com/chainflip",
|
|
18
|
-
telegram: "https://t.me/
|
|
18
|
+
telegram: "https://t.me/chainflip_io_chat"
|
|
19
19
|
};
|
|
20
20
|
var brokerAliasMap = {
|
|
21
21
|
cFLRQDfEdmnv6d2XfHJNRBQHi4fruPMReLSfvB8WWD2ENbqj7: {
|
|
@@ -95,6 +95,10 @@ var brokerAliasMap = {
|
|
|
95
95
|
cFL4To8Uow6B1hk4dNrhWhvKpkBtnUTrVdWCEKCaXiXMMztjM: {
|
|
96
96
|
name: "SwapKit",
|
|
97
97
|
twitter: "@SwapKitPowered"
|
|
98
|
+
},
|
|
99
|
+
cFKe4xhoVd783CUTYNxMua4eVE3pSDnbvjLXVRpeq2qC9bSZi: {
|
|
100
|
+
name: "Cake Wallet",
|
|
101
|
+
twitter: "@cakewallet"
|
|
98
102
|
}
|
|
99
103
|
};
|
|
100
104
|
var lpAliasMap = {
|
package/dist/ss58.cjs
CHANGED
|
@@ -725,7 +725,8 @@ var hexToBytes = (input) => {
|
|
|
725
725
|
}
|
|
726
726
|
return bytes;
|
|
727
727
|
};
|
|
728
|
-
var convertBase = (
|
|
728
|
+
var convertBase = (inputBytes, fromBase, toBase) => {
|
|
729
|
+
const bytes = typeof inputBytes === "string" ? hexToBytes(inputBytes) : new Uint8Array(inputBytes);
|
|
729
730
|
const result = [];
|
|
730
731
|
for (const byte of bytes) {
|
|
731
732
|
let carry = byte;
|
package/dist/ss58.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { HexString } from './types.cjs';
|
|
1
|
+
import { Bytelike, HexString } from './types.cjs';
|
|
2
2
|
|
|
3
3
|
declare const decode: (input: string) => {
|
|
4
4
|
data: Uint8Array;
|
|
5
5
|
ss58Format: number;
|
|
6
6
|
};
|
|
7
7
|
declare const encode: ({ data: input, ss58Format, }: {
|
|
8
|
-
data:
|
|
8
|
+
data: Bytelike;
|
|
9
9
|
ss58Format: number;
|
|
10
10
|
}) => string;
|
|
11
11
|
declare const toPublicKey: (address: string) => HexString;
|
package/dist/ss58.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { HexString } from './types.js';
|
|
1
|
+
import { Bytelike, HexString } from './types.js';
|
|
2
2
|
|
|
3
3
|
declare const decode: (input: string) => {
|
|
4
4
|
data: Uint8Array;
|
|
5
5
|
ss58Format: number;
|
|
6
6
|
};
|
|
7
7
|
declare const encode: ({ data: input, ss58Format, }: {
|
|
8
|
-
data:
|
|
8
|
+
data: Bytelike;
|
|
9
9
|
ss58Format: number;
|
|
10
10
|
}) => string;
|
|
11
11
|
declare const toPublicKey: (address: string) => HexString;
|
package/dist/ss58.js
CHANGED
package/dist/types.d.cts
CHANGED
package/dist/types.d.ts
CHANGED