@flashnet/sdk 0.1.1
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/README.md +479 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/src/api/client.d.ts +20 -0
- package/dist/src/api/client.d.ts.map +1 -0
- package/dist/src/api/client.js +85 -0
- package/dist/src/api/client.js.map +1 -0
- package/dist/src/api/typed-endpoints.d.ts +135 -0
- package/dist/src/api/typed-endpoints.d.ts.map +1 -0
- package/dist/src/api/typed-endpoints.js +202 -0
- package/dist/src/api/typed-endpoints.js.map +1 -0
- package/dist/src/api/validation.d.ts +114 -0
- package/dist/src/api/validation.d.ts.map +1 -0
- package/dist/src/api/validation.js +128 -0
- package/dist/src/api/validation.js.map +1 -0
- package/dist/src/client/FlashnetClient.d.ts +216 -0
- package/dist/src/client/FlashnetClient.d.ts.map +1 -0
- package/dist/src/client/FlashnetClient.js +800 -0
- package/dist/src/client/FlashnetClient.js.map +1 -0
- package/dist/src/config/index.d.ts +14 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +40 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/types/index.d.ts +484 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +2 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/utils/auth.d.ts +26 -0
- package/dist/src/utils/auth.d.ts.map +1 -0
- package/dist/src/utils/auth.js +85 -0
- package/dist/src/utils/auth.js.map +1 -0
- package/dist/src/utils/index.d.ts +8 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/index.js +19 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/utils/intents.d.ts +86 -0
- package/dist/src/utils/intents.d.ts.map +1 -0
- package/dist/src/utils/intents.js +133 -0
- package/dist/src/utils/intents.js.map +1 -0
- package/dist/src/utils/signer.d.ts +29 -0
- package/dist/src/utils/signer.d.ts.map +1 -0
- package/dist/src/utils/signer.js +34 -0
- package/dist/src/utils/signer.js.map +1 -0
- package/dist/src/utils/spark-address.d.ts +60 -0
- package/dist/src/utils/spark-address.d.ts.map +1 -0
- package/dist/src/utils/spark-address.js +227 -0
- package/dist/src/utils/spark-address.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { secp256k1 } from '@noble/curves/secp256k1';
|
|
2
|
+
import { bytesToHex, hexToBytes } from '@noble/hashes/utils';
|
|
3
|
+
import { bech32m } from '@scure/base';
|
|
4
|
+
const AddressNetworkPrefix = {
|
|
5
|
+
MAINNET: 'sp',
|
|
6
|
+
TESTNET: 'spt',
|
|
7
|
+
REGTEST: 'sprt',
|
|
8
|
+
SIGNET: 'sps',
|
|
9
|
+
LOCAL: 'spl',
|
|
10
|
+
};
|
|
11
|
+
const PrefixToNetwork = Object.fromEntries(Object.entries(AddressNetworkPrefix).map(([network, prefix]) => [
|
|
12
|
+
prefix,
|
|
13
|
+
network,
|
|
14
|
+
]));
|
|
15
|
+
/**
|
|
16
|
+
* Simple implementation of protobuf-style encoding for SparkAddress
|
|
17
|
+
* Field 1: identityPublicKey (bytes type)
|
|
18
|
+
*/
|
|
19
|
+
function encodeProto(publicKeyBytes) {
|
|
20
|
+
// Calculate the total length: tag (1 byte) + length prefix (1 byte) + key bytes
|
|
21
|
+
const length = 2 + publicKeyBytes.length;
|
|
22
|
+
const result = new Uint8Array(length);
|
|
23
|
+
// Field 1, wire type 2 (length-delimited) = tag 10 (1 << 3 | 2)
|
|
24
|
+
result[0] = 10;
|
|
25
|
+
// Length of the key bytes
|
|
26
|
+
result[1] = publicKeyBytes.length;
|
|
27
|
+
// Copy the key bytes
|
|
28
|
+
result.set(publicKeyBytes, 2);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Simple implementation of protobuf-style decoding for SparkAddress
|
|
33
|
+
*/
|
|
34
|
+
function decodeProto(data) {
|
|
35
|
+
let pos = 0;
|
|
36
|
+
const result = {
|
|
37
|
+
identityPublicKey: new Uint8Array(0),
|
|
38
|
+
};
|
|
39
|
+
while (pos < data.length) {
|
|
40
|
+
// Read tag
|
|
41
|
+
const tag = data[pos++];
|
|
42
|
+
// Field 1, wire type 2 (length-delimited) = tag 10
|
|
43
|
+
if (tag === 10) {
|
|
44
|
+
// Read length
|
|
45
|
+
const length = data[pos++] ?? 0;
|
|
46
|
+
// Read bytes
|
|
47
|
+
result.identityPublicKey = data.slice(pos, pos + length);
|
|
48
|
+
pos += length;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Skip unknown fields
|
|
52
|
+
// For simplicity, we only handle field 1 and assume no other fields exist
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Basic validation: check if a public key was actually decoded
|
|
57
|
+
if (result.identityPublicKey.length === 0) {
|
|
58
|
+
throw new Error('Failed to decode public key from proto bytes');
|
|
59
|
+
}
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Encodes a public key and network into a Spark address
|
|
64
|
+
* @param payload Object containing hex public key and network type
|
|
65
|
+
* @returns Bech32m encoded Spark address
|
|
66
|
+
*/
|
|
67
|
+
export function encodeSparkAddress(payload) {
|
|
68
|
+
isValidPublicKey(payload.identityPublicKey);
|
|
69
|
+
// Convert hex public key to bytes
|
|
70
|
+
const publicKeyBytes = hexToBytes(payload.identityPublicKey);
|
|
71
|
+
// Use proto-style encoding to match the original implementation
|
|
72
|
+
const protoEncoded = encodeProto(publicKeyBytes);
|
|
73
|
+
// Convert to bech32m words
|
|
74
|
+
const words = bech32m.toWords(protoEncoded);
|
|
75
|
+
// Encode with bech32m
|
|
76
|
+
const prefix = AddressNetworkPrefix[payload.network];
|
|
77
|
+
const encoded = bech32m.encode(prefix, words, 200);
|
|
78
|
+
return encoded;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Decodes a Spark address to extract the public key
|
|
82
|
+
* @param address Bech32m encoded Spark address
|
|
83
|
+
* @param network Expected network type (used to check prefix)
|
|
84
|
+
* @returns Hex-encoded public key
|
|
85
|
+
* @throws Error if address format, prefix, or decoded key is invalid
|
|
86
|
+
*/
|
|
87
|
+
export function decodeSparkAddress(address, network) {
|
|
88
|
+
const prefix = AddressNetworkPrefix[network];
|
|
89
|
+
if (!address?.startsWith(prefix)) {
|
|
90
|
+
throw new Error(`Invalid Spark address: expected prefix ${prefix}`);
|
|
91
|
+
}
|
|
92
|
+
// Decode the bech32m address
|
|
93
|
+
const sparkAddress = address;
|
|
94
|
+
const decoded = bech32m.decode(sparkAddress, 200);
|
|
95
|
+
// Convert words back to bytes
|
|
96
|
+
const protoBytes = bech32m.fromWords(decoded.words);
|
|
97
|
+
// Decode the proto format to get the SparkAddress
|
|
98
|
+
const sparkAddressData = decodeProto(protoBytes);
|
|
99
|
+
// Convert the public key bytes back to hex
|
|
100
|
+
const publicKey = bytesToHex(sparkAddressData.identityPublicKey);
|
|
101
|
+
// Validate the extracted public key
|
|
102
|
+
isValidPublicKey(publicKey);
|
|
103
|
+
return publicKey;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Attempts to determine the network type from a Spark address prefix.
|
|
107
|
+
* @param address The potential Spark address.
|
|
108
|
+
* @returns The NetworkType ('MAINNET', 'REGTEST', etc.) or null if the prefix is invalid.
|
|
109
|
+
*/
|
|
110
|
+
export function getNetworkFromAddress(address) {
|
|
111
|
+
if (!address || typeof address !== 'string') {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const parts = address.split('1');
|
|
115
|
+
if (parts.length < 2) {
|
|
116
|
+
return null; // Missing separator '1'
|
|
117
|
+
}
|
|
118
|
+
const prefix = parts[0] ?? '';
|
|
119
|
+
return PrefixToNetwork[prefix] || null; // Return NetworkType or null
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Checks if a string is a valid Spark address for *any* known network,
|
|
123
|
+
* and optionally validates against a specific network.
|
|
124
|
+
* @param address String to validate
|
|
125
|
+
* @param network Optional specific network type to check against
|
|
126
|
+
* @returns Boolean indicating validity
|
|
127
|
+
*/
|
|
128
|
+
export function isValidSparkAddress(address, network) {
|
|
129
|
+
try {
|
|
130
|
+
if (!address?.includes('1')) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
const addressAsPossibleFormat = address;
|
|
134
|
+
const decoded = bech32m.decode(addressAsPossibleFormat, 200);
|
|
135
|
+
const prefix = decoded.prefix;
|
|
136
|
+
// Check if prefix is known
|
|
137
|
+
const networkFromPrefix = PrefixToNetwork[prefix];
|
|
138
|
+
if (!networkFromPrefix) {
|
|
139
|
+
return false; // Unknown prefix
|
|
140
|
+
}
|
|
141
|
+
// If a specific network is required, check if it matches
|
|
142
|
+
if (network && network !== networkFromPrefix) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
// Try to decode the payload and validate the pubkey
|
|
146
|
+
const protoBytes = bech32m.fromWords(decoded.words);
|
|
147
|
+
const sparkAddressData = decodeProto(protoBytes);
|
|
148
|
+
const publicKey = bytesToHex(sparkAddressData.identityPublicKey);
|
|
149
|
+
isValidPublicKey(publicKey); // Throws on invalid key
|
|
150
|
+
return true; // All checks passed
|
|
151
|
+
}
|
|
152
|
+
catch (_error) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Checks if a string looks like a valid hex-encoded public key (basic check).
|
|
158
|
+
* Does NOT validate point on curve here, use isValidPublicKey for that.
|
|
159
|
+
* @param key The potential public key hex string.
|
|
160
|
+
* @returns True if it matches the basic format, false otherwise.
|
|
161
|
+
*/
|
|
162
|
+
export function looksLikePublicKey(key) {
|
|
163
|
+
if (!key || typeof key !== 'string') {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
return key.length === 66 && /^(02|03)[0-9a-fA-F]{64}$/.test(key);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Validates a secp256k1 public key format and curve point.
|
|
170
|
+
* @param publicKey Hex-encoded public key
|
|
171
|
+
* @throws Error if public key is invalid
|
|
172
|
+
*/
|
|
173
|
+
export function isValidPublicKey(publicKey) {
|
|
174
|
+
if (!looksLikePublicKey(publicKey)) {
|
|
175
|
+
throw new Error('Invalid public key format/length.');
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
const point = secp256k1.ProjectivePoint.fromHex(publicKey);
|
|
179
|
+
point.assertValidity();
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
183
|
+
throw new Error(`Invalid public key point: ${errorMessage}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Converts a Spark address to a specific network.
|
|
188
|
+
* If the address is already on the requested network, it returns the original address.
|
|
189
|
+
* Otherwise, it extracts the public key and creates a new address for the target network.
|
|
190
|
+
*
|
|
191
|
+
* @param sparkAddress The Spark address to convert
|
|
192
|
+
* @param targetNetwork The target network ('mainnet' or 'regtest')
|
|
193
|
+
* @returns The Spark address for the target network or null if conversion fails
|
|
194
|
+
*/
|
|
195
|
+
export function convertSparkAddressToNetwork(sparkAddress, targetNetwork) {
|
|
196
|
+
try {
|
|
197
|
+
// Check if the address is valid
|
|
198
|
+
if (!isValidSparkAddress(sparkAddress)) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
// Extract the current network from the address
|
|
202
|
+
const currentNetworkType = getNetworkFromAddress(sparkAddress);
|
|
203
|
+
if (!currentNetworkType) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
// Map the input string to NetworkType
|
|
207
|
+
const targetNetworkType = targetNetwork === 'mainnet' ? 'MAINNET' : 'REGTEST';
|
|
208
|
+
// If already on the target network, return the original address
|
|
209
|
+
if (currentNetworkType === targetNetworkType) {
|
|
210
|
+
return sparkAddress;
|
|
211
|
+
}
|
|
212
|
+
// Extract the public key from the address
|
|
213
|
+
const decoded = bech32m.decode(sparkAddress, 200);
|
|
214
|
+
const protoBytes = bech32m.fromWords(decoded.words);
|
|
215
|
+
const sparkAddressData = decodeProto(protoBytes);
|
|
216
|
+
const publicKey = bytesToHex(sparkAddressData.identityPublicKey);
|
|
217
|
+
// Create a new address for the target network
|
|
218
|
+
return encodeSparkAddress({
|
|
219
|
+
identityPublicKey: publicKey,
|
|
220
|
+
network: targetNetworkType,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
catch (_error) {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=spark-address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spark-address.js","sourceRoot":"","sources":["../../../src/utils/spark-address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AActC,MAAM,oBAAoB,GAAgC;IACxD,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;CACJ,CAAC;AAEX,MAAM,eAAe,GAAgC,MAAM,CAAC,WAAW,CACrE,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;IAC9D,MAAM;IACN,OAAsB;CACvB,CAAC,CACH,CAAC;AAUF;;;GAGG;AACH,SAAS,WAAW,CAAC,cAA0B;IAC7C,gFAAgF;IAChF,MAAM,MAAM,GAAG,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;IACzC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d,CAAC;QAED,+CAA+C;QAC/C,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;QAC/D,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,sCAAsC;QACtC,MAAM,iBAAiB,GACrB,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAEtD,gEAAgE;QAChE,IAAI,kBAAkB,KAAK,iBAAiB,EAAE,CAAC;YAC7C,OAAO,YAAY,CAAC;QACtB,CAAC;QAED,0CAA0C;QAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,YAAkC,EAAE,GAAG,CAAC,CAAC;QACxE,MAAM,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACpD,MAAM,gBAAgB,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,UAAU,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QAEjE,8CAA8C;QAC9C,OAAO,kBAAkB,CAAC;YACxB,iBAAiB,EAAE,SAAS;YAC5B,OAAO,EAAE,iBAAiB;SAC3B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,MAAe,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flashnet/sdk",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"module": "dist/index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"dev": "tsc --watch",
|
|
21
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@biomejs/biome": "2.0.5",
|
|
25
|
+
"@types/bun": "latest",
|
|
26
|
+
"@types/node": "^20.0.0",
|
|
27
|
+
"typescript": "^5"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"typescript": "^5"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@buildonspark/issuer-sdk": "^0.0.74",
|
|
34
|
+
"@buildonspark/spark-sdk": "0.1.43",
|
|
35
|
+
"@noble/curves": "^1.7.0",
|
|
36
|
+
"@noble/hashes": "^1.8.0",
|
|
37
|
+
"@noble/secp256k1": "^2.3.0",
|
|
38
|
+
"@scure/base": "^1.2.1"
|
|
39
|
+
},
|
|
40
|
+
"author": "",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"description": "Flashnet SDK for Spark wallet operations and AMM interactions"
|
|
43
|
+
}
|