@sip-protocol/sdk 0.3.2 → 0.4.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/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +1019 -146
- package/dist/browser.mjs +49 -1
- package/dist/chunk-AOZIY3GU.mjs +12995 -0
- package/dist/chunk-BCLIX5T2.mjs +12940 -0
- package/dist/chunk-FKXPHKYD.mjs +12955 -0
- package/dist/chunk-OPQ2GQIO.mjs +13013 -0
- package/dist/index-BcWNakUD.d.ts +7990 -0
- package/dist/index-BsKY3Hr0.d.mts +7990 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +990 -117
- package/dist/index.mjs +49 -1
- package/package.json +2 -1
- package/src/adapters/near-intents.ts +8 -0
- package/src/bitcoin/index.ts +51 -0
- package/src/bitcoin/silent-payments.ts +865 -0
- package/src/bitcoin/taproot.ts +590 -0
- package/src/cosmos/ibc-stealth.ts +825 -0
- package/src/cosmos/index.ts +83 -0
- package/src/cosmos/stealth.ts +487 -0
- package/src/index.ts +51 -0
- package/src/move/aptos.ts +369 -0
- package/src/move/index.ts +35 -0
- package/src/move/sui.ts +367 -0
- package/src/oracle/types.ts +8 -0
- package/src/settlement/backends/direct-chain.ts +8 -0
- package/src/stealth.ts +3 -3
- package/src/validation.ts +42 -1
- package/src/wallet/aptos/adapter.ts +422 -0
- package/src/wallet/aptos/index.ts +10 -0
- package/src/wallet/aptos/mock.ts +410 -0
- package/src/wallet/aptos/types.ts +278 -0
- package/src/wallet/bitcoin/adapter.ts +470 -0
- package/src/wallet/bitcoin/index.ts +38 -0
- package/src/wallet/bitcoin/mock.ts +516 -0
- package/src/wallet/bitcoin/types.ts +274 -0
- package/src/wallet/cosmos/adapter.ts +484 -0
- package/src/wallet/cosmos/index.ts +63 -0
- package/src/wallet/cosmos/mock.ts +596 -0
- package/src/wallet/cosmos/types.ts +462 -0
- package/src/wallet/index.ts +127 -0
- package/src/wallet/sui/adapter.ts +471 -0
- package/src/wallet/sui/index.ts +10 -0
- package/src/wallet/sui/mock.ts +439 -0
- package/src/wallet/sui/types.ts +245 -0
package/dist/browser.js
CHANGED
|
@@ -31,10 +31,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var browser_exports = {};
|
|
32
32
|
__export(browser_exports, {
|
|
33
33
|
ATTESTATION_VERSION: () => ATTESTATION_VERSION,
|
|
34
|
+
AptosStealthService: () => AptosStealthService,
|
|
34
35
|
BaseWalletAdapter: () => BaseWalletAdapter,
|
|
35
36
|
BrowserNoirProvider: () => BrowserNoirProvider,
|
|
36
37
|
CHAIN_NUMERIC_IDS: () => CHAIN_NUMERIC_IDS,
|
|
38
|
+
COSMOS_CHAIN_PREFIXES: () => CHAIN_PREFIXES,
|
|
37
39
|
ComplianceManager: () => ComplianceManager,
|
|
40
|
+
CosmosStealthService: () => CosmosStealthService,
|
|
38
41
|
CryptoError: () => CryptoError,
|
|
39
42
|
DEFAULT_THRESHOLD: () => DEFAULT_THRESHOLD,
|
|
40
43
|
DEFAULT_TOTAL_ORACLES: () => DEFAULT_TOTAL_ORACLES,
|
|
@@ -47,7 +50,7 @@ __export(browser_exports, {
|
|
|
47
50
|
HardwareWalletError: () => HardwareWalletError,
|
|
48
51
|
IntentBuilder: () => IntentBuilder,
|
|
49
52
|
IntentError: () => IntentError,
|
|
50
|
-
IntentStatus: () =>
|
|
53
|
+
IntentStatus: () => import_types55.IntentStatus,
|
|
51
54
|
LedgerWalletAdapter: () => LedgerWalletAdapter,
|
|
52
55
|
MockEthereumAdapter: () => MockEthereumAdapter,
|
|
53
56
|
MockLedgerAdapter: () => MockLedgerAdapter,
|
|
@@ -56,28 +59,28 @@ __export(browser_exports, {
|
|
|
56
59
|
MockSolver: () => MockSolver,
|
|
57
60
|
MockTrezorAdapter: () => MockTrezorAdapter,
|
|
58
61
|
MockWalletAdapter: () => MockWalletAdapter,
|
|
59
|
-
NATIVE_TOKENS: () =>
|
|
62
|
+
NATIVE_TOKENS: () => import_types55.NATIVE_TOKENS,
|
|
60
63
|
NEARIntentsAdapter: () => NEARIntentsAdapter,
|
|
61
64
|
NEARIntentsBackend: () => NEARIntentsBackend,
|
|
62
65
|
NetworkError: () => NetworkError,
|
|
63
66
|
ORACLE_DOMAIN: () => ORACLE_DOMAIN,
|
|
64
67
|
OneClickClient: () => OneClickClient,
|
|
65
|
-
OneClickDepositMode: () =>
|
|
66
|
-
OneClickErrorCode: () =>
|
|
67
|
-
OneClickSwapStatus: () =>
|
|
68
|
-
OneClickSwapType: () =>
|
|
68
|
+
OneClickDepositMode: () => import_types59.OneClickDepositMode,
|
|
69
|
+
OneClickErrorCode: () => import_types59.OneClickErrorCode,
|
|
70
|
+
OneClickSwapStatus: () => import_types59.OneClickSwapStatus,
|
|
71
|
+
OneClickSwapType: () => import_types59.OneClickSwapType,
|
|
69
72
|
PaymentBuilder: () => PaymentBuilder,
|
|
70
|
-
PaymentStatus: () =>
|
|
71
|
-
PrivacyLevel: () =>
|
|
73
|
+
PaymentStatus: () => import_types56.PaymentStatus,
|
|
74
|
+
PrivacyLevel: () => import_types55.PrivacyLevel,
|
|
72
75
|
ProofError: () => ProofError,
|
|
73
76
|
ProofGenerationError: () => ProofGenerationError,
|
|
74
77
|
ProofNotImplementedError: () => ProofNotImplementedError,
|
|
75
78
|
ProofWorker: () => ProofWorker,
|
|
76
|
-
ProposalStatus: () =>
|
|
77
|
-
ReportStatus: () =>
|
|
79
|
+
ProposalStatus: () => import_types57.ProposalStatus,
|
|
80
|
+
ReportStatus: () => import_types58.ReportStatus,
|
|
78
81
|
SIP: () => SIP,
|
|
79
82
|
SIPError: () => SIPError,
|
|
80
|
-
SIP_VERSION: () =>
|
|
83
|
+
SIP_VERSION: () => import_types55.SIP_VERSION,
|
|
81
84
|
STABLECOIN_ADDRESSES: () => STABLECOIN_ADDRESSES,
|
|
82
85
|
STABLECOIN_DECIMALS: () => STABLECOIN_DECIMALS,
|
|
83
86
|
STABLECOIN_INFO: () => STABLECOIN_INFO,
|
|
@@ -90,8 +93,8 @@ __export(browser_exports, {
|
|
|
90
93
|
TrezorWalletAdapter: () => TrezorWalletAdapter,
|
|
91
94
|
ValidationError: () => ValidationError,
|
|
92
95
|
WalletError: () => WalletError,
|
|
93
|
-
WalletErrorCode: () =>
|
|
94
|
-
ZcashErrorCode: () =>
|
|
96
|
+
WalletErrorCode: () => import_types54.WalletErrorCode,
|
|
97
|
+
ZcashErrorCode: () => import_types60.ZcashErrorCode,
|
|
95
98
|
ZcashNativeBackend: () => ZcashNativeBackend,
|
|
96
99
|
ZcashRPCClient: () => ZcashRPCClient,
|
|
97
100
|
ZcashRPCError: () => ZcashRPCError,
|
|
@@ -100,18 +103,22 @@ __export(browser_exports, {
|
|
|
100
103
|
addBlindings: () => addBlindings,
|
|
101
104
|
addCommitments: () => addCommitments,
|
|
102
105
|
addOracle: () => addOracle,
|
|
106
|
+
aptosAddressToAuthKey: () => aptosAddressToAuthKey,
|
|
103
107
|
attachProofs: () => attachProofs,
|
|
104
108
|
base58ToHex: () => base58ToHex,
|
|
105
|
-
browserBytesToHex: () =>
|
|
106
|
-
browserHexToBytes: () =>
|
|
109
|
+
browserBytesToHex: () => bytesToHex11,
|
|
110
|
+
browserHexToBytes: () => hexToBytes9,
|
|
111
|
+
checkAptosStealthAddress: () => checkAptosStealthAddress,
|
|
107
112
|
checkEd25519StealthAddress: () => checkEd25519StealthAddress,
|
|
108
113
|
checkMobileWASMCompatibility: () => checkMobileWASMCompatibility,
|
|
109
114
|
checkStealthAddress: () => checkStealthAddress,
|
|
110
115
|
commit: () => commit,
|
|
111
116
|
commitZero: () => commitZero,
|
|
112
117
|
computeAttestationHash: () => computeAttestationHash,
|
|
118
|
+
computeTweakedKey: () => computeTweakedKey,
|
|
113
119
|
createCommitment: () => createCommitment,
|
|
114
120
|
createEthereumAdapter: () => createEthereumAdapter,
|
|
121
|
+
createKeySpendOnlyOutput: () => createKeySpendOnlyOutput,
|
|
115
122
|
createLedgerAdapter: () => createLedgerAdapter,
|
|
116
123
|
createMockEthereumAdapter: () => createMockEthereumAdapter,
|
|
117
124
|
createMockEthereumProvider: () => createMockEthereumProvider,
|
|
@@ -130,6 +137,7 @@ __export(browser_exports, {
|
|
|
130
137
|
createShieldedPayment: () => createShieldedPayment,
|
|
131
138
|
createSmartRouter: () => createSmartRouter,
|
|
132
139
|
createSolanaAdapter: () => createSolanaAdapter,
|
|
140
|
+
createTaprootOutput: () => createTaprootOutput,
|
|
133
141
|
createTrezorAdapter: () => createTrezorAdapter,
|
|
134
142
|
createWalletFactory: () => createWalletFactory,
|
|
135
143
|
createWorkerBlobURL: () => createWorkerBlobURL,
|
|
@@ -138,8 +146,10 @@ __export(browser_exports, {
|
|
|
138
146
|
createZcashShieldedService: () => createZcashShieldedService,
|
|
139
147
|
createZcashSwapService: () => createZcashSwapService,
|
|
140
148
|
decodeStealthMetaAddress: () => decodeStealthMetaAddress,
|
|
149
|
+
decodeTaprootAddress: () => decodeTaprootAddress,
|
|
141
150
|
decryptMemo: () => decryptMemo,
|
|
142
151
|
decryptWithViewing: () => decryptWithViewing,
|
|
152
|
+
deriveAptosStealthPrivateKey: () => deriveAptosStealthPrivateKey,
|
|
143
153
|
deriveEd25519StealthPrivateKey: () => deriveEd25519StealthPrivateKey,
|
|
144
154
|
deriveOracleId: () => deriveOracleId,
|
|
145
155
|
deriveStealthPrivateKey: () => deriveStealthPrivateKey,
|
|
@@ -151,6 +161,7 @@ __export(browser_exports, {
|
|
|
151
161
|
detectMobileBrowser: () => detectMobileBrowser,
|
|
152
162
|
detectMobilePlatform: () => detectMobilePlatform,
|
|
153
163
|
detectSolanaWallets: () => detectSolanaWallets,
|
|
164
|
+
ed25519PublicKeyToAptosAddress: () => ed25519PublicKeyToAptosAddress,
|
|
154
165
|
ed25519PublicKeyToNearAddress: () => ed25519PublicKeyToNearAddress,
|
|
155
166
|
ed25519PublicKeyToSolanaAddress: () => ed25519PublicKeyToSolanaAddress,
|
|
156
167
|
encodeStealthMetaAddress: () => encodeStealthMetaAddress,
|
|
@@ -159,7 +170,10 @@ __export(browser_exports, {
|
|
|
159
170
|
formatStablecoinAmount: () => formatStablecoinAmount,
|
|
160
171
|
fromHex: () => fromHex,
|
|
161
172
|
fromStablecoinUnits: () => fromStablecoinUnits,
|
|
173
|
+
generateAptosStealthAddress: () => generateAptosStealthAddress,
|
|
162
174
|
generateBlinding: () => generateBlinding,
|
|
175
|
+
generateCosmosStealthAddress: () => generateCosmosStealthAddress,
|
|
176
|
+
generateCosmosStealthMetaAddress: () => generateCosmosStealthMetaAddress,
|
|
163
177
|
generateEd25519StealthAddress: () => generateEd25519StealthAddress,
|
|
164
178
|
generateEd25519StealthMetaAddress: () => generateEd25519StealthMetaAddress,
|
|
165
179
|
generateIntentId: () => generateIntentId,
|
|
@@ -192,6 +206,7 @@ __export(browser_exports, {
|
|
|
192
206
|
getStablecoinsForChain: () => getStablecoinsForChain,
|
|
193
207
|
getSupportedStablecoins: () => getSupportedStablecoins,
|
|
194
208
|
getTimeRemaining: () => getTimeRemaining,
|
|
209
|
+
getXOnlyPublicKey: () => getXOnlyPublicKey,
|
|
195
210
|
hasEnoughOracles: () => hasEnoughOracles,
|
|
196
211
|
hasErrorCode: () => hasErrorCode,
|
|
197
212
|
hasRequiredProofs: () => hasRequiredProofs,
|
|
@@ -202,15 +217,17 @@ __export(browser_exports, {
|
|
|
202
217
|
isExpired: () => isExpired,
|
|
203
218
|
isNonNegativeAmount: () => isNonNegativeAmount,
|
|
204
219
|
isPaymentExpired: () => isPaymentExpired,
|
|
205
|
-
isPrivate: () =>
|
|
220
|
+
isPrivate: () => import_types55.isPrivate,
|
|
206
221
|
isPrivateWalletAdapter: () => isPrivateWalletAdapter,
|
|
207
222
|
isSIPError: () => isSIPError,
|
|
208
223
|
isStablecoin: () => isStablecoin,
|
|
209
224
|
isStablecoinOnChain: () => isStablecoinOnChain,
|
|
210
225
|
isTablet: () => isTablet,
|
|
211
226
|
isValidAmount: () => isValidAmount,
|
|
227
|
+
isValidAptosAddress: () => isValidAptosAddress,
|
|
212
228
|
isValidChainId: () => isValidChainId,
|
|
213
229
|
isValidCompressedPublicKey: () => isValidCompressedPublicKey,
|
|
230
|
+
isValidCosmosAddress: () => isValidCosmosAddress,
|
|
214
231
|
isValidEd25519PublicKey: () => isValidEd25519PublicKey,
|
|
215
232
|
isValidHex: () => isValidHex,
|
|
216
233
|
isValidHexLength: () => isValidHexLength,
|
|
@@ -222,12 +239,17 @@ __export(browser_exports, {
|
|
|
222
239
|
isValidSlippage: () => isValidSlippage,
|
|
223
240
|
isValidSolanaAddress: () => isValidSolanaAddress,
|
|
224
241
|
isValidStealthMetaAddress: () => isValidStealthMetaAddress,
|
|
242
|
+
isValidTaprootAddress: () => isValidTaprootAddress,
|
|
225
243
|
nearAddressToEd25519PublicKey: () => nearAddressToEd25519PublicKey,
|
|
226
244
|
normalizeAddress: () => normalizeAddress,
|
|
227
245
|
notConnectedError: () => notConnectedError,
|
|
228
246
|
publicKeyToEthAddress: () => publicKeyToEthAddress,
|
|
229
247
|
registerWallet: () => registerWallet,
|
|
230
248
|
removeOracle: () => removeOracle,
|
|
249
|
+
schnorrSign: () => schnorrSign,
|
|
250
|
+
schnorrSignHex: () => schnorrSignHex,
|
|
251
|
+
schnorrVerify: () => schnorrVerify,
|
|
252
|
+
schnorrVerifyHex: () => schnorrVerifyHex,
|
|
231
253
|
secureWipe: () => secureWipe,
|
|
232
254
|
secureWipeAll: () => secureWipeAll,
|
|
233
255
|
serializeAttestationMessage: () => serializeAttestationMessage,
|
|
@@ -236,17 +258,19 @@ __export(browser_exports, {
|
|
|
236
258
|
signAttestationMessage: () => signAttestationMessage,
|
|
237
259
|
solanaAddressToEd25519PublicKey: () => solanaAddressToEd25519PublicKey,
|
|
238
260
|
solanaPublicKeyToHex: () => solanaPublicKeyToHex,
|
|
261
|
+
stealthKeyToCosmosAddress: () => stealthKeyToCosmosAddress,
|
|
239
262
|
subtractBlindings: () => subtractBlindings,
|
|
240
263
|
subtractCommitments: () => subtractCommitments,
|
|
241
264
|
supportsSharedArrayBuffer: () => supportsSharedArrayBuffer,
|
|
242
265
|
supportsTouch: () => supportsTouch,
|
|
243
|
-
supportsViewingKey: () =>
|
|
266
|
+
supportsViewingKey: () => import_types55.supportsViewingKey,
|
|
244
267
|
supportsWASMBulkMemory: () => supportsWASMBulkMemory,
|
|
245
268
|
supportsWASMSimd: () => supportsWASMSimd,
|
|
246
269
|
supportsWebBluetooth: () => supportsWebBluetooth,
|
|
247
270
|
supportsWebHID: () => supportsWebHID,
|
|
248
271
|
supportsWebUSB: () => supportsWebUSB,
|
|
249
272
|
supportsWebWorkers: () => supportsWebWorkers,
|
|
273
|
+
taprootAddress: () => taprootAddress,
|
|
250
274
|
toHex: () => toHex,
|
|
251
275
|
toStablecoinUnits: () => toStablecoinUnits,
|
|
252
276
|
trackIntent: () => trackIntent,
|
|
@@ -487,7 +511,16 @@ var VALID_CHAIN_IDS = [
|
|
|
487
511
|
"polygon",
|
|
488
512
|
"arbitrum",
|
|
489
513
|
"optimism",
|
|
490
|
-
"base"
|
|
514
|
+
"base",
|
|
515
|
+
"bitcoin",
|
|
516
|
+
"aptos",
|
|
517
|
+
"sui",
|
|
518
|
+
"cosmos",
|
|
519
|
+
"osmosis",
|
|
520
|
+
"injective",
|
|
521
|
+
"celestia",
|
|
522
|
+
"sei",
|
|
523
|
+
"dydx"
|
|
491
524
|
];
|
|
492
525
|
function isValidChainId(chain) {
|
|
493
526
|
return VALID_CHAIN_IDS.includes(chain);
|
|
@@ -684,6 +717,12 @@ function isValidNearAddressFormat(address) {
|
|
|
684
717
|
if (address.includes("..")) return false;
|
|
685
718
|
return true;
|
|
686
719
|
}
|
|
720
|
+
function isValidCosmosAddressFormat(address) {
|
|
721
|
+
if (typeof address !== "string") return false;
|
|
722
|
+
if (address.length < 39 || address.length > 90) return false;
|
|
723
|
+
const bech32Pattern = /^[a-z]+1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38,}$/;
|
|
724
|
+
return bech32Pattern.test(address);
|
|
725
|
+
}
|
|
687
726
|
function getChainAddressType(chain) {
|
|
688
727
|
switch (chain) {
|
|
689
728
|
case "ethereum":
|
|
@@ -698,6 +737,13 @@ function getChainAddressType(chain) {
|
|
|
698
737
|
return "near";
|
|
699
738
|
case "zcash":
|
|
700
739
|
return "zcash";
|
|
740
|
+
case "cosmos":
|
|
741
|
+
case "osmosis":
|
|
742
|
+
case "injective":
|
|
743
|
+
case "celestia":
|
|
744
|
+
case "sei":
|
|
745
|
+
case "dydx":
|
|
746
|
+
return "cosmos";
|
|
701
747
|
default:
|
|
702
748
|
return "unknown";
|
|
703
749
|
}
|
|
@@ -741,6 +787,15 @@ function validateAddressForChain(address, chain, field = "address") {
|
|
|
741
787
|
);
|
|
742
788
|
}
|
|
743
789
|
break;
|
|
790
|
+
case "cosmos":
|
|
791
|
+
if (!isValidCosmosAddressFormat(address)) {
|
|
792
|
+
throw new ValidationError(
|
|
793
|
+
`Invalid address format for ${chain}. Expected Cosmos bech32 address, got: ${address.slice(0, 20)}...`,
|
|
794
|
+
field,
|
|
795
|
+
{ chain, expectedFormat: "bech32" }
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
break;
|
|
744
799
|
default:
|
|
745
800
|
break;
|
|
746
801
|
}
|
|
@@ -792,7 +847,7 @@ function secureWipeAll(...buffers) {
|
|
|
792
847
|
function generateStealthMetaAddress(chain, label) {
|
|
793
848
|
if (!isValidChainId(chain)) {
|
|
794
849
|
throw new ValidationError(
|
|
795
|
-
`invalid chain '${chain}', must be one of: solana, ethereum, near, zcash, polygon, arbitrum, optimism, base`,
|
|
850
|
+
`invalid chain '${chain}', must be one of: solana, ethereum, near, zcash, polygon, arbitrum, optimism, base, bitcoin, aptos, sui, cosmos, osmosis, injective, celestia, sei, dydx`,
|
|
796
851
|
"chain"
|
|
797
852
|
);
|
|
798
853
|
}
|
|
@@ -1072,7 +1127,7 @@ function toChecksumAddress(address) {
|
|
|
1072
1127
|
return checksummed;
|
|
1073
1128
|
}
|
|
1074
1129
|
var ED25519_ORDER = 2n ** 252n + 27742317777372353535851937790883648493n;
|
|
1075
|
-
var ED25519_CHAINS = ["solana", "near"];
|
|
1130
|
+
var ED25519_CHAINS = ["solana", "near", "aptos", "sui"];
|
|
1076
1131
|
function isEd25519Chain(chain) {
|
|
1077
1132
|
return ED25519_CHAINS.includes(chain);
|
|
1078
1133
|
}
|
|
@@ -1157,7 +1212,7 @@ function bigIntToBytesLE(value, length) {
|
|
|
1157
1212
|
function generateEd25519StealthMetaAddress(chain, label) {
|
|
1158
1213
|
if (!isValidChainId(chain)) {
|
|
1159
1214
|
throw new ValidationError(
|
|
1160
|
-
`invalid chain '${chain}', must be one of: solana, ethereum, near, zcash, polygon, arbitrum, optimism, base`,
|
|
1215
|
+
`invalid chain '${chain}', must be one of: solana, ethereum, near, zcash, polygon, arbitrum, optimism, base, bitcoin, aptos, sui, cosmos, osmosis, injective, celestia, sei, dydx`,
|
|
1161
1216
|
"chain"
|
|
1162
1217
|
);
|
|
1163
1218
|
}
|
|
@@ -2527,7 +2582,15 @@ var CHAIN_BLOCKCHAIN_MAP = {
|
|
|
2527
2582
|
arbitrum: "evm",
|
|
2528
2583
|
optimism: "evm",
|
|
2529
2584
|
base: "evm",
|
|
2530
|
-
bitcoin: "bitcoin"
|
|
2585
|
+
bitcoin: "bitcoin",
|
|
2586
|
+
aptos: "aptos",
|
|
2587
|
+
sui: "sui",
|
|
2588
|
+
cosmos: "cosmos",
|
|
2589
|
+
osmosis: "cosmos",
|
|
2590
|
+
injective: "cosmos",
|
|
2591
|
+
celestia: "cosmos",
|
|
2592
|
+
sei: "cosmos",
|
|
2593
|
+
dydx: "cosmos"
|
|
2531
2594
|
};
|
|
2532
2595
|
var NEARIntentsAdapter = class {
|
|
2533
2596
|
client;
|
|
@@ -3287,6 +3350,448 @@ function createProductionSIP(config) {
|
|
|
3287
3350
|
});
|
|
3288
3351
|
}
|
|
3289
3352
|
|
|
3353
|
+
// src/move/aptos.ts
|
|
3354
|
+
var import_sha32 = require("@noble/hashes/sha3");
|
|
3355
|
+
var import_utils7 = require("@noble/hashes/utils");
|
|
3356
|
+
var APTOS_SINGLE_ED25519_SCHEME = 0;
|
|
3357
|
+
function ed25519PublicKeyToAptosAddress(publicKey) {
|
|
3358
|
+
if (!isValidHex(publicKey)) {
|
|
3359
|
+
throw new ValidationError(
|
|
3360
|
+
"publicKey must be a valid hex string with 0x prefix",
|
|
3361
|
+
"publicKey"
|
|
3362
|
+
);
|
|
3363
|
+
}
|
|
3364
|
+
if (!isValidEd25519PublicKey(publicKey)) {
|
|
3365
|
+
throw new ValidationError(
|
|
3366
|
+
"publicKey must be 32 bytes (64 hex characters)",
|
|
3367
|
+
"publicKey"
|
|
3368
|
+
);
|
|
3369
|
+
}
|
|
3370
|
+
const publicKeyBytes = (0, import_utils7.hexToBytes)(publicKey.slice(2));
|
|
3371
|
+
const authKeyInput = new Uint8Array(publicKeyBytes.length + 1);
|
|
3372
|
+
authKeyInput.set(publicKeyBytes, 0);
|
|
3373
|
+
authKeyInput[publicKeyBytes.length] = APTOS_SINGLE_ED25519_SCHEME;
|
|
3374
|
+
const addressHash = (0, import_sha32.sha3_256)(authKeyInput);
|
|
3375
|
+
return `0x${(0, import_utils7.bytesToHex)(addressHash)}`;
|
|
3376
|
+
}
|
|
3377
|
+
function isValidAptosAddress(address) {
|
|
3378
|
+
if (typeof address !== "string" || address.length === 0) {
|
|
3379
|
+
return false;
|
|
3380
|
+
}
|
|
3381
|
+
if (!address.startsWith("0x")) {
|
|
3382
|
+
return false;
|
|
3383
|
+
}
|
|
3384
|
+
const hexPart = address.slice(2);
|
|
3385
|
+
if (hexPart.length !== 64) {
|
|
3386
|
+
return false;
|
|
3387
|
+
}
|
|
3388
|
+
return /^[0-9a-fA-F]{64}$/.test(hexPart);
|
|
3389
|
+
}
|
|
3390
|
+
function aptosAddressToAuthKey(address) {
|
|
3391
|
+
if (!isValidAptosAddress(address)) {
|
|
3392
|
+
throw new ValidationError(
|
|
3393
|
+
"Invalid Aptos address format (must be 0x-prefixed 64 hex characters)",
|
|
3394
|
+
"address"
|
|
3395
|
+
);
|
|
3396
|
+
}
|
|
3397
|
+
return address.toLowerCase();
|
|
3398
|
+
}
|
|
3399
|
+
function generateAptosStealthAddress(recipientMetaAddress) {
|
|
3400
|
+
if (recipientMetaAddress.chain !== "aptos") {
|
|
3401
|
+
throw new ValidationError(
|
|
3402
|
+
`Expected chain 'aptos', got '${recipientMetaAddress.chain}'`,
|
|
3403
|
+
"recipientMetaAddress.chain"
|
|
3404
|
+
);
|
|
3405
|
+
}
|
|
3406
|
+
const { stealthAddress, sharedSecret } = generateEd25519StealthAddress(recipientMetaAddress);
|
|
3407
|
+
const aptosAddress = ed25519PublicKeyToAptosAddress(stealthAddress.address);
|
|
3408
|
+
return {
|
|
3409
|
+
stealthAddress: aptosAddress,
|
|
3410
|
+
stealthPublicKey: stealthAddress.address,
|
|
3411
|
+
ephemeralPublicKey: stealthAddress.ephemeralPublicKey,
|
|
3412
|
+
viewTag: stealthAddress.viewTag,
|
|
3413
|
+
sharedSecret
|
|
3414
|
+
};
|
|
3415
|
+
}
|
|
3416
|
+
function deriveAptosStealthPrivateKey(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
|
|
3417
|
+
const recovery = deriveEd25519StealthPrivateKey(
|
|
3418
|
+
stealthAddress,
|
|
3419
|
+
spendingPrivateKey,
|
|
3420
|
+
viewingPrivateKey
|
|
3421
|
+
);
|
|
3422
|
+
const aptosAddress = ed25519PublicKeyToAptosAddress(recovery.stealthAddress);
|
|
3423
|
+
return {
|
|
3424
|
+
...recovery,
|
|
3425
|
+
aptosAddress
|
|
3426
|
+
};
|
|
3427
|
+
}
|
|
3428
|
+
function checkAptosStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
|
|
3429
|
+
return checkEd25519StealthAddress(
|
|
3430
|
+
stealthAddress,
|
|
3431
|
+
spendingPrivateKey,
|
|
3432
|
+
viewingPrivateKey
|
|
3433
|
+
);
|
|
3434
|
+
}
|
|
3435
|
+
var AptosStealthService = class {
|
|
3436
|
+
/**
|
|
3437
|
+
* Generate a stealth address for an Aptos recipient
|
|
3438
|
+
*
|
|
3439
|
+
* @param recipientMetaAddress - Recipient's stealth meta-address
|
|
3440
|
+
* @returns Complete stealth address result
|
|
3441
|
+
*/
|
|
3442
|
+
generateStealthAddress(recipientMetaAddress) {
|
|
3443
|
+
return generateAptosStealthAddress(recipientMetaAddress);
|
|
3444
|
+
}
|
|
3445
|
+
/**
|
|
3446
|
+
* Convert an ed25519 public key to Aptos address format
|
|
3447
|
+
*
|
|
3448
|
+
* @param publicKey - 32-byte ed25519 public key
|
|
3449
|
+
* @returns Aptos address string
|
|
3450
|
+
*/
|
|
3451
|
+
stealthKeyToAptosAddress(publicKey) {
|
|
3452
|
+
return ed25519PublicKeyToAptosAddress(publicKey);
|
|
3453
|
+
}
|
|
3454
|
+
/**
|
|
3455
|
+
* Derive the private key for a stealth address
|
|
3456
|
+
*
|
|
3457
|
+
* @param stealthAddress - Stealth address data
|
|
3458
|
+
* @param spendingPrivateKey - Recipient's spending private key
|
|
3459
|
+
* @param viewingPrivateKey - Recipient's viewing private key
|
|
3460
|
+
* @returns Recovery data with derived private key
|
|
3461
|
+
*/
|
|
3462
|
+
deriveStealthPrivateKey(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
|
|
3463
|
+
return deriveAptosStealthPrivateKey(stealthAddress, spendingPrivateKey, viewingPrivateKey);
|
|
3464
|
+
}
|
|
3465
|
+
/**
|
|
3466
|
+
* Check if a stealth address belongs to this recipient
|
|
3467
|
+
*
|
|
3468
|
+
* @param stealthAddress - Stealth address to check
|
|
3469
|
+
* @param spendingPrivateKey - Recipient's spending private key
|
|
3470
|
+
* @param viewingPrivateKey - Recipient's viewing private key
|
|
3471
|
+
* @returns true if the address belongs to this recipient
|
|
3472
|
+
*/
|
|
3473
|
+
checkStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
|
|
3474
|
+
return checkAptosStealthAddress(stealthAddress, spendingPrivateKey, viewingPrivateKey);
|
|
3475
|
+
}
|
|
3476
|
+
/**
|
|
3477
|
+
* Validate an Aptos address format
|
|
3478
|
+
*
|
|
3479
|
+
* @param address - Address to validate
|
|
3480
|
+
* @returns true if valid format
|
|
3481
|
+
*/
|
|
3482
|
+
isValidAddress(address) {
|
|
3483
|
+
return isValidAptosAddress(address);
|
|
3484
|
+
}
|
|
3485
|
+
};
|
|
3486
|
+
|
|
3487
|
+
// src/move/sui.ts
|
|
3488
|
+
var import_blake2b = require("@noble/hashes/blake2b");
|
|
3489
|
+
var import_utils8 = require("@noble/hashes/utils");
|
|
3490
|
+
|
|
3491
|
+
// src/cosmos/stealth.ts
|
|
3492
|
+
var import_sha2566 = require("@noble/hashes/sha256");
|
|
3493
|
+
var import_ripemd160 = require("@noble/hashes/ripemd160");
|
|
3494
|
+
var import_utils9 = require("@noble/hashes/utils");
|
|
3495
|
+
var import_base = require("@scure/base");
|
|
3496
|
+
var CHAIN_PREFIXES = {
|
|
3497
|
+
cosmos: "cosmos",
|
|
3498
|
+
osmosis: "osmo",
|
|
3499
|
+
injective: "inj",
|
|
3500
|
+
celestia: "celestia",
|
|
3501
|
+
sei: "sei",
|
|
3502
|
+
dydx: "dydx"
|
|
3503
|
+
};
|
|
3504
|
+
var CosmosStealthService = class {
|
|
3505
|
+
/**
|
|
3506
|
+
* Generate a stealth meta-address for a Cosmos chain
|
|
3507
|
+
*
|
|
3508
|
+
* @param chain - Cosmos chain identifier
|
|
3509
|
+
* @param label - Optional human-readable label
|
|
3510
|
+
* @returns Stealth meta-address and private keys
|
|
3511
|
+
* @throws {ValidationError} If chain is invalid
|
|
3512
|
+
*
|
|
3513
|
+
* @example
|
|
3514
|
+
* ```typescript
|
|
3515
|
+
* const service = new CosmosStealthService()
|
|
3516
|
+
* const { metaAddress, spendingPrivateKey, viewingPrivateKey } =
|
|
3517
|
+
* service.generateStealthMetaAddress('cosmos', 'My Cosmos Wallet')
|
|
3518
|
+
* ```
|
|
3519
|
+
*/
|
|
3520
|
+
generateStealthMetaAddress(chain, label) {
|
|
3521
|
+
if (!this.isValidCosmosChain(chain)) {
|
|
3522
|
+
throw new ValidationError(
|
|
3523
|
+
`invalid Cosmos chain '${chain}', must be one of: ${Object.keys(CHAIN_PREFIXES).join(", ")}`,
|
|
3524
|
+
"chain"
|
|
3525
|
+
);
|
|
3526
|
+
}
|
|
3527
|
+
const result = generateStealthMetaAddress("ethereum", label);
|
|
3528
|
+
return {
|
|
3529
|
+
...result,
|
|
3530
|
+
metaAddress: {
|
|
3531
|
+
...result.metaAddress,
|
|
3532
|
+
chain
|
|
3533
|
+
// Will be updated in types package
|
|
3534
|
+
}
|
|
3535
|
+
};
|
|
3536
|
+
}
|
|
3537
|
+
/**
|
|
3538
|
+
* Generate a one-time stealth address for a Cosmos chain
|
|
3539
|
+
*
|
|
3540
|
+
* @param spendingPubKey - Recipient's spending public key (33-byte compressed)
|
|
3541
|
+
* @param viewingPubKey - Recipient's viewing public key (33-byte compressed)
|
|
3542
|
+
* @param chain - Cosmos chain identifier
|
|
3543
|
+
* @returns Cosmos stealth address with bech32 encoding
|
|
3544
|
+
* @throws {ValidationError} If keys or chain are invalid
|
|
3545
|
+
*
|
|
3546
|
+
* @example
|
|
3547
|
+
* ```typescript
|
|
3548
|
+
* const service = new CosmosStealthService()
|
|
3549
|
+
* const result = service.generateStealthAddress(
|
|
3550
|
+
* spendingKey,
|
|
3551
|
+
* viewingKey,
|
|
3552
|
+
* 'osmosis'
|
|
3553
|
+
* )
|
|
3554
|
+
* console.log(result.stealthAddress) // "osmo1..."
|
|
3555
|
+
* ```
|
|
3556
|
+
*/
|
|
3557
|
+
generateStealthAddress(spendingPubKey, viewingPubKey, chain) {
|
|
3558
|
+
if (!this.isValidCosmosChain(chain)) {
|
|
3559
|
+
throw new ValidationError(
|
|
3560
|
+
`invalid Cosmos chain '${chain}', must be one of: ${Object.keys(CHAIN_PREFIXES).join(", ")}`,
|
|
3561
|
+
"chain"
|
|
3562
|
+
);
|
|
3563
|
+
}
|
|
3564
|
+
if (spendingPubKey.length !== 33) {
|
|
3565
|
+
throw new ValidationError(
|
|
3566
|
+
"spendingPubKey must be 33 bytes (compressed secp256k1)",
|
|
3567
|
+
"spendingPubKey"
|
|
3568
|
+
);
|
|
3569
|
+
}
|
|
3570
|
+
if (viewingPubKey.length !== 33) {
|
|
3571
|
+
throw new ValidationError(
|
|
3572
|
+
"viewingPubKey must be 33 bytes (compressed secp256k1)",
|
|
3573
|
+
"viewingPubKey"
|
|
3574
|
+
);
|
|
3575
|
+
}
|
|
3576
|
+
const metaAddress = {
|
|
3577
|
+
spendingKey: `0x${(0, import_utils9.bytesToHex)(spendingPubKey)}`,
|
|
3578
|
+
viewingKey: `0x${(0, import_utils9.bytesToHex)(viewingPubKey)}`,
|
|
3579
|
+
chain: "ethereum"
|
|
3580
|
+
// Use ethereum for secp256k1 generation
|
|
3581
|
+
};
|
|
3582
|
+
const { stealthAddress, sharedSecret } = generateStealthAddress(metaAddress);
|
|
3583
|
+
const cosmosAddress = this.stealthKeyToCosmosAddress(
|
|
3584
|
+
(0, import_utils9.hexToBytes)(stealthAddress.address.slice(2)),
|
|
3585
|
+
CHAIN_PREFIXES[chain]
|
|
3586
|
+
);
|
|
3587
|
+
return {
|
|
3588
|
+
stealthAddress: cosmosAddress,
|
|
3589
|
+
stealthPublicKey: stealthAddress.address,
|
|
3590
|
+
ephemeralPublicKey: stealthAddress.ephemeralPublicKey,
|
|
3591
|
+
viewTag: stealthAddress.viewTag,
|
|
3592
|
+
viewKeyHash: sharedSecret
|
|
3593
|
+
};
|
|
3594
|
+
}
|
|
3595
|
+
/**
|
|
3596
|
+
* Generate stealth address from StealthMetaAddress
|
|
3597
|
+
*
|
|
3598
|
+
* Convenience method that accepts a StealthMetaAddress directly.
|
|
3599
|
+
*
|
|
3600
|
+
* @param recipientMetaAddress - Recipient's stealth meta-address
|
|
3601
|
+
* @param chain - Cosmos chain identifier
|
|
3602
|
+
* @returns Cosmos stealth address with bech32 encoding
|
|
3603
|
+
* @throws {ValidationError} If meta-address or chain are invalid
|
|
3604
|
+
*
|
|
3605
|
+
* @example
|
|
3606
|
+
* ```typescript
|
|
3607
|
+
* const service = new CosmosStealthService()
|
|
3608
|
+
* const result = service.generateStealthAddressFromMeta(metaAddress, 'cosmos')
|
|
3609
|
+
* ```
|
|
3610
|
+
*/
|
|
3611
|
+
generateStealthAddressFromMeta(recipientMetaAddress, chain) {
|
|
3612
|
+
const spendingPubKey = (0, import_utils9.hexToBytes)(recipientMetaAddress.spendingKey.slice(2));
|
|
3613
|
+
const viewingPubKey = (0, import_utils9.hexToBytes)(recipientMetaAddress.viewingKey.slice(2));
|
|
3614
|
+
return this.generateStealthAddress(spendingPubKey, viewingPubKey, chain);
|
|
3615
|
+
}
|
|
3616
|
+
/**
|
|
3617
|
+
* Convert stealth public key to Cosmos bech32 address
|
|
3618
|
+
*
|
|
3619
|
+
* Algorithm:
|
|
3620
|
+
* 1. SHA256 hash of compressed public key
|
|
3621
|
+
* 2. RIPEMD160 hash of SHA256 hash
|
|
3622
|
+
* 3. Bech32 encode with chain prefix
|
|
3623
|
+
*
|
|
3624
|
+
* @param publicKey - Compressed secp256k1 public key (33 bytes)
|
|
3625
|
+
* @param prefix - Bech32 address prefix (e.g., "cosmos", "osmo")
|
|
3626
|
+
* @returns Bech32-encoded address
|
|
3627
|
+
* @throws {ValidationError} If public key is invalid
|
|
3628
|
+
*
|
|
3629
|
+
* @example
|
|
3630
|
+
* ```typescript
|
|
3631
|
+
* const service = new CosmosStealthService()
|
|
3632
|
+
* const address = service.stealthKeyToCosmosAddress(pubKey, 'cosmos')
|
|
3633
|
+
* // Returns: "cosmos1abc..."
|
|
3634
|
+
* ```
|
|
3635
|
+
*/
|
|
3636
|
+
stealthKeyToCosmosAddress(publicKey, prefix) {
|
|
3637
|
+
if (publicKey.length !== 33) {
|
|
3638
|
+
throw new ValidationError(
|
|
3639
|
+
"public key must be 33 bytes (compressed secp256k1)",
|
|
3640
|
+
"publicKey"
|
|
3641
|
+
);
|
|
3642
|
+
}
|
|
3643
|
+
const sha256Hash = (0, import_sha2566.sha256)(publicKey);
|
|
3644
|
+
const hash160 = (0, import_ripemd160.ripemd160)(sha256Hash);
|
|
3645
|
+
const words = import_base.bech32.toWords(hash160);
|
|
3646
|
+
return import_base.bech32.encode(prefix, words);
|
|
3647
|
+
}
|
|
3648
|
+
/**
|
|
3649
|
+
* Derive stealth private key for recipient to claim funds
|
|
3650
|
+
*
|
|
3651
|
+
* @param stealthAddress - The stealth address to recover (as StealthAddress)
|
|
3652
|
+
* @param spendingPrivateKey - Recipient's spending private key
|
|
3653
|
+
* @param viewingPrivateKey - Recipient's viewing private key
|
|
3654
|
+
* @returns Recovery data with derived private key
|
|
3655
|
+
* @throws {ValidationError} If any input is invalid
|
|
3656
|
+
*
|
|
3657
|
+
* @example
|
|
3658
|
+
* ```typescript
|
|
3659
|
+
* const service = new CosmosStealthService()
|
|
3660
|
+
* const recovery = service.deriveStealthPrivateKey(
|
|
3661
|
+
* stealthAddress,
|
|
3662
|
+
* spendingPrivKey,
|
|
3663
|
+
* viewingPrivKey
|
|
3664
|
+
* )
|
|
3665
|
+
* // Use recovery.privateKey to spend funds
|
|
3666
|
+
* ```
|
|
3667
|
+
*/
|
|
3668
|
+
deriveStealthPrivateKey(stealthAddress, spendingPrivateKey, viewingPrivateKey) {
|
|
3669
|
+
return deriveStealthPrivateKey(
|
|
3670
|
+
stealthAddress,
|
|
3671
|
+
spendingPrivateKey,
|
|
3672
|
+
viewingPrivateKey
|
|
3673
|
+
);
|
|
3674
|
+
}
|
|
3675
|
+
/**
|
|
3676
|
+
* Check if a string is a valid Cosmos chain identifier
|
|
3677
|
+
*/
|
|
3678
|
+
isValidCosmosChain(chain) {
|
|
3679
|
+
return chain in CHAIN_PREFIXES;
|
|
3680
|
+
}
|
|
3681
|
+
/**
|
|
3682
|
+
* Decode a Cosmos bech32 address to raw hash
|
|
3683
|
+
*
|
|
3684
|
+
* @param address - Bech32-encoded address
|
|
3685
|
+
* @returns Decoded address hash (20 bytes)
|
|
3686
|
+
* @throws {ValidationError} If address is invalid
|
|
3687
|
+
*
|
|
3688
|
+
* @example
|
|
3689
|
+
* ```typescript
|
|
3690
|
+
* const service = new CosmosStealthService()
|
|
3691
|
+
* const { prefix, hash } = service.decodeBech32Address('cosmos1abc...')
|
|
3692
|
+
* ```
|
|
3693
|
+
*/
|
|
3694
|
+
decodeBech32Address(address) {
|
|
3695
|
+
try {
|
|
3696
|
+
const decoded = import_base.bech32.decode(address);
|
|
3697
|
+
const hash2 = import_base.bech32.fromWords(decoded.words);
|
|
3698
|
+
if (hash2.length !== 20) {
|
|
3699
|
+
throw new ValidationError(
|
|
3700
|
+
`invalid address hash length: ${hash2.length}, expected 20`,
|
|
3701
|
+
"address"
|
|
3702
|
+
);
|
|
3703
|
+
}
|
|
3704
|
+
return {
|
|
3705
|
+
prefix: decoded.prefix,
|
|
3706
|
+
hash: new Uint8Array(hash2)
|
|
3707
|
+
};
|
|
3708
|
+
} catch (error) {
|
|
3709
|
+
if (error instanceof ValidationError) {
|
|
3710
|
+
throw error;
|
|
3711
|
+
}
|
|
3712
|
+
throw new ValidationError(
|
|
3713
|
+
`invalid bech32 address: ${error instanceof Error ? error.message : "unknown error"}`,
|
|
3714
|
+
"address"
|
|
3715
|
+
);
|
|
3716
|
+
}
|
|
3717
|
+
}
|
|
3718
|
+
/**
|
|
3719
|
+
* Validate a Cosmos bech32 address format
|
|
3720
|
+
*
|
|
3721
|
+
* @param address - Address to validate
|
|
3722
|
+
* @param expectedChain - Optional chain to validate prefix against
|
|
3723
|
+
* @returns true if valid, false otherwise
|
|
3724
|
+
*
|
|
3725
|
+
* @example
|
|
3726
|
+
* ```typescript
|
|
3727
|
+
* const service = new CosmosStealthService()
|
|
3728
|
+
* service.isValidCosmosAddress('cosmos1abc...', 'cosmos') // true
|
|
3729
|
+
* service.isValidCosmosAddress('osmo1xyz...', 'cosmos') // false (wrong prefix)
|
|
3730
|
+
* ```
|
|
3731
|
+
*/
|
|
3732
|
+
isValidCosmosAddress(address, expectedChain) {
|
|
3733
|
+
try {
|
|
3734
|
+
const { prefix, hash: hash2 } = this.decodeBech32Address(address);
|
|
3735
|
+
if (hash2.length !== 20) {
|
|
3736
|
+
return false;
|
|
3737
|
+
}
|
|
3738
|
+
if (expectedChain) {
|
|
3739
|
+
return prefix === CHAIN_PREFIXES[expectedChain];
|
|
3740
|
+
}
|
|
3741
|
+
return Object.values(CHAIN_PREFIXES).includes(prefix);
|
|
3742
|
+
} catch {
|
|
3743
|
+
return false;
|
|
3744
|
+
}
|
|
3745
|
+
}
|
|
3746
|
+
/**
|
|
3747
|
+
* Get the chain ID from a bech32 address prefix
|
|
3748
|
+
*
|
|
3749
|
+
* @param address - Bech32-encoded address
|
|
3750
|
+
* @returns Chain ID or null if unknown prefix
|
|
3751
|
+
*
|
|
3752
|
+
* @example
|
|
3753
|
+
* ```typescript
|
|
3754
|
+
* const service = new CosmosStealthService()
|
|
3755
|
+
* service.getChainFromAddress('cosmos1abc...') // 'cosmos'
|
|
3756
|
+
* service.getChainFromAddress('osmo1xyz...') // 'osmosis'
|
|
3757
|
+
* ```
|
|
3758
|
+
*/
|
|
3759
|
+
getChainFromAddress(address) {
|
|
3760
|
+
try {
|
|
3761
|
+
const { prefix } = this.decodeBech32Address(address);
|
|
3762
|
+
for (const [chain, chainPrefix] of Object.entries(CHAIN_PREFIXES)) {
|
|
3763
|
+
if (chainPrefix === prefix) {
|
|
3764
|
+
return chain;
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
return null;
|
|
3768
|
+
} catch {
|
|
3769
|
+
return null;
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
};
|
|
3773
|
+
function generateCosmosStealthMetaAddress(chain, label) {
|
|
3774
|
+
const service = new CosmosStealthService();
|
|
3775
|
+
return service.generateStealthMetaAddress(chain, label);
|
|
3776
|
+
}
|
|
3777
|
+
function generateCosmosStealthAddress(spendingPubKey, viewingPubKey, chain) {
|
|
3778
|
+
const service = new CosmosStealthService();
|
|
3779
|
+
return service.generateStealthAddress(spendingPubKey, viewingPubKey, chain);
|
|
3780
|
+
}
|
|
3781
|
+
function stealthKeyToCosmosAddress(publicKey, prefix) {
|
|
3782
|
+
const service = new CosmosStealthService();
|
|
3783
|
+
return service.stealthKeyToCosmosAddress(publicKey, prefix);
|
|
3784
|
+
}
|
|
3785
|
+
function isValidCosmosAddress(address, expectedChain) {
|
|
3786
|
+
const service = new CosmosStealthService();
|
|
3787
|
+
return service.isValidCosmosAddress(address, expectedChain);
|
|
3788
|
+
}
|
|
3789
|
+
|
|
3790
|
+
// src/cosmos/ibc-stealth.ts
|
|
3791
|
+
var import_utils10 = require("@noble/hashes/utils");
|
|
3792
|
+
var import_secp256k13 = require("@noble/curves/secp256k1");
|
|
3793
|
+
var import_sha2567 = require("@noble/hashes/sha256");
|
|
3794
|
+
|
|
3290
3795
|
// src/proofs/interface.ts
|
|
3291
3796
|
var ProofGenerationError = class extends Error {
|
|
3292
3797
|
proofType;
|
|
@@ -3300,8 +3805,8 @@ var ProofGenerationError = class extends Error {
|
|
|
3300
3805
|
};
|
|
3301
3806
|
|
|
3302
3807
|
// src/proofs/mock.ts
|
|
3303
|
-
var
|
|
3304
|
-
var
|
|
3808
|
+
var import_sha2568 = require("@noble/hashes/sha256");
|
|
3809
|
+
var import_utils11 = require("@noble/hashes/utils");
|
|
3305
3810
|
var MOCK_PROOF_PREFIX = "0x4d4f434b";
|
|
3306
3811
|
var WARNING_MESSAGE = `
|
|
3307
3812
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
@@ -3466,17 +3971,17 @@ var MockProofProvider = class {
|
|
|
3466
3971
|
{ type: proofType, params },
|
|
3467
3972
|
(_, v) => typeof v === "bigint" ? v.toString() : v
|
|
3468
3973
|
);
|
|
3469
|
-
const hash2 = (0,
|
|
3470
|
-
const random = (0,
|
|
3974
|
+
const hash2 = (0, import_sha2568.sha256)(new TextEncoder().encode(input));
|
|
3975
|
+
const random = (0, import_utils11.randomBytes)(16);
|
|
3471
3976
|
const combined = new Uint8Array(4 + hash2.length + random.length);
|
|
3472
3977
|
combined.set(new TextEncoder().encode("MOCK"), 0);
|
|
3473
3978
|
combined.set(hash2, 4);
|
|
3474
3979
|
combined.set(random, 4 + hash2.length);
|
|
3475
|
-
return `${MOCK_PROOF_PREFIX}${(0,
|
|
3980
|
+
return `${MOCK_PROOF_PREFIX}${(0, import_utils11.bytesToHex)(combined.slice(4))}`;
|
|
3476
3981
|
}
|
|
3477
3982
|
hashToHex(data) {
|
|
3478
|
-
const hash2 = (0,
|
|
3479
|
-
return `0x${(0,
|
|
3983
|
+
const hash2 = (0, import_sha2568.sha256)(new TextEncoder().encode(data));
|
|
3984
|
+
return `0x${(0, import_utils11.bytesToHex)(hash2)}`;
|
|
3480
3985
|
}
|
|
3481
3986
|
};
|
|
3482
3987
|
|
|
@@ -3755,7 +4260,7 @@ function checkMobileWASMCompatibility() {
|
|
|
3755
4260
|
recommendations
|
|
3756
4261
|
};
|
|
3757
4262
|
}
|
|
3758
|
-
function
|
|
4263
|
+
function hexToBytes9(hex) {
|
|
3759
4264
|
const h = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
3760
4265
|
if (h.length === 0) return new Uint8Array(0);
|
|
3761
4266
|
if (h.length % 2 !== 0) {
|
|
@@ -3767,7 +4272,7 @@ function hexToBytes5(hex) {
|
|
|
3767
4272
|
}
|
|
3768
4273
|
return bytes;
|
|
3769
4274
|
}
|
|
3770
|
-
function
|
|
4275
|
+
function bytesToHex11(bytes) {
|
|
3771
4276
|
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
3772
4277
|
}
|
|
3773
4278
|
function isBrowser() {
|
|
@@ -3809,18 +4314,34 @@ var CHAIN_NUMERIC_IDS = {
|
|
|
3809
4314
|
// Non-standard, SIP-specific
|
|
3810
4315
|
near: 502,
|
|
3811
4316
|
// Non-standard, SIP-specific
|
|
3812
|
-
zcash: 503
|
|
4317
|
+
zcash: 503,
|
|
4318
|
+
// Non-standard, SIP-specific
|
|
4319
|
+
aptos: 504,
|
|
4320
|
+
// Non-standard, SIP-specific
|
|
4321
|
+
sui: 505,
|
|
4322
|
+
// Non-standard, SIP-specific
|
|
4323
|
+
cosmos: 506,
|
|
4324
|
+
// Non-standard, SIP-specific (Cosmos Hub)
|
|
4325
|
+
osmosis: 507,
|
|
4326
|
+
// Non-standard, SIP-specific
|
|
4327
|
+
injective: 508,
|
|
4328
|
+
// Non-standard, SIP-specific
|
|
4329
|
+
celestia: 509,
|
|
4330
|
+
// Non-standard, SIP-specific
|
|
4331
|
+
sei: 510,
|
|
4332
|
+
// Non-standard, SIP-specific
|
|
4333
|
+
dydx: 511
|
|
3813
4334
|
// Non-standard, SIP-specific
|
|
3814
4335
|
};
|
|
3815
4336
|
|
|
3816
4337
|
// src/oracle/verification.ts
|
|
3817
4338
|
var import_ed255192 = require("@noble/curves/ed25519");
|
|
3818
|
-
var
|
|
3819
|
-
var
|
|
4339
|
+
var import_sha25610 = require("@noble/hashes/sha256");
|
|
4340
|
+
var import_utils13 = require("@noble/hashes/utils");
|
|
3820
4341
|
|
|
3821
4342
|
// src/oracle/serialization.ts
|
|
3822
|
-
var
|
|
3823
|
-
var
|
|
4343
|
+
var import_sha2569 = require("@noble/hashes/sha256");
|
|
4344
|
+
var import_utils12 = require("@noble/hashes/utils");
|
|
3824
4345
|
function serializeAttestationMessage(message) {
|
|
3825
4346
|
const buffer = new Uint8Array(197);
|
|
3826
4347
|
const view = new DataView(buffer.buffer);
|
|
@@ -3863,19 +4384,19 @@ function deserializeAttestationMessage(bytes) {
|
|
|
3863
4384
|
const version = bytes[offset++];
|
|
3864
4385
|
const chainId = view.getUint32(offset, false);
|
|
3865
4386
|
offset += 4;
|
|
3866
|
-
const intentHash = `0x${(0,
|
|
4387
|
+
const intentHash = `0x${(0, import_utils12.bytesToHex)(bytes.slice(offset, offset + 32))}`;
|
|
3867
4388
|
offset += 32;
|
|
3868
|
-
const recipient = `0x${(0,
|
|
4389
|
+
const recipient = `0x${(0, import_utils12.bytesToHex)(bytes.slice(offset, offset + 32))}`;
|
|
3869
4390
|
offset += 32;
|
|
3870
4391
|
const amount = bytesToBigint(bytes.slice(offset, offset + 16));
|
|
3871
4392
|
offset += 16;
|
|
3872
|
-
const assetId = `0x${(0,
|
|
4393
|
+
const assetId = `0x${(0, import_utils12.bytesToHex)(bytes.slice(offset, offset + 32))}`;
|
|
3873
4394
|
offset += 32;
|
|
3874
|
-
const txHash = `0x${(0,
|
|
4395
|
+
const txHash = `0x${(0, import_utils12.bytesToHex)(bytes.slice(offset, offset + 32))}`;
|
|
3875
4396
|
offset += 32;
|
|
3876
4397
|
const blockNumber = view.getBigUint64(offset, false);
|
|
3877
4398
|
offset += 8;
|
|
3878
|
-
const blockHash = `0x${(0,
|
|
4399
|
+
const blockHash = `0x${(0, import_utils12.bytesToHex)(bytes.slice(offset, offset + 32))}`;
|
|
3879
4400
|
offset += 32;
|
|
3880
4401
|
const timestamp = Number(view.getBigUint64(offset, false));
|
|
3881
4402
|
return {
|
|
@@ -3892,12 +4413,12 @@ function deserializeAttestationMessage(bytes) {
|
|
|
3892
4413
|
};
|
|
3893
4414
|
}
|
|
3894
4415
|
function computeAttestationHash(message) {
|
|
3895
|
-
const domain = (0,
|
|
4416
|
+
const domain = (0, import_utils12.utf8ToBytes)(ORACLE_DOMAIN);
|
|
3896
4417
|
const messageBytes = serializeAttestationMessage(message);
|
|
3897
4418
|
const toHash = new Uint8Array(domain.length + messageBytes.length);
|
|
3898
4419
|
toHash.set(domain, 0);
|
|
3899
4420
|
toHash.set(messageBytes, domain.length);
|
|
3900
|
-
return (0,
|
|
4421
|
+
return (0, import_sha2569.sha256)(toHash);
|
|
3901
4422
|
}
|
|
3902
4423
|
function getChainNumericId(chain) {
|
|
3903
4424
|
const id = CHAIN_NUMERIC_IDS[chain];
|
|
@@ -3908,7 +4429,7 @@ function getChainNumericId(chain) {
|
|
|
3908
4429
|
}
|
|
3909
4430
|
function normalizeToBytes(hex, length, field) {
|
|
3910
4431
|
const stripped = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
3911
|
-
const bytes = (0,
|
|
4432
|
+
const bytes = (0, import_utils12.hexToBytes)(stripped);
|
|
3912
4433
|
if (bytes.length === length) {
|
|
3913
4434
|
return bytes;
|
|
3914
4435
|
}
|
|
@@ -3941,9 +4462,9 @@ function bytesToBigint(bytes) {
|
|
|
3941
4462
|
|
|
3942
4463
|
// src/oracle/verification.ts
|
|
3943
4464
|
function deriveOracleId(publicKey) {
|
|
3944
|
-
const keyBytes = typeof publicKey === "string" ? (0,
|
|
3945
|
-
const hash2 = (0,
|
|
3946
|
-
return `0x${(0,
|
|
4465
|
+
const keyBytes = typeof publicKey === "string" ? (0, import_utils13.hexToBytes)(publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey) : publicKey;
|
|
4466
|
+
const hash2 = (0, import_sha25610.sha256)(keyBytes);
|
|
4467
|
+
return `0x${(0, import_utils13.bytesToHex)(hash2)}`;
|
|
3947
4468
|
}
|
|
3948
4469
|
function verifyAttestation(attestation, registry) {
|
|
3949
4470
|
const { message, signatures } = attestation;
|
|
@@ -3973,10 +4494,10 @@ function verifyAttestation(attestation, registry) {
|
|
|
3973
4494
|
continue;
|
|
3974
4495
|
}
|
|
3975
4496
|
try {
|
|
3976
|
-
const publicKeyBytes = (0,
|
|
4497
|
+
const publicKeyBytes = (0, import_utils13.hexToBytes)(
|
|
3977
4498
|
oracle.publicKey.startsWith("0x") ? oracle.publicKey.slice(2) : oracle.publicKey
|
|
3978
4499
|
);
|
|
3979
|
-
const signatureBytes = (0,
|
|
4500
|
+
const signatureBytes = (0, import_utils13.hexToBytes)(
|
|
3980
4501
|
sig.signature.startsWith("0x") ? sig.signature.slice(2) : sig.signature
|
|
3981
4502
|
);
|
|
3982
4503
|
const isValid = import_ed255192.ed25519.verify(signatureBytes, messageHash, publicKeyBytes);
|
|
@@ -4001,10 +4522,10 @@ function verifyAttestation(attestation, registry) {
|
|
|
4001
4522
|
}
|
|
4002
4523
|
function verifyOracleSignature(signature, messageHash, oracle) {
|
|
4003
4524
|
try {
|
|
4004
|
-
const publicKeyBytes = (0,
|
|
4525
|
+
const publicKeyBytes = (0, import_utils13.hexToBytes)(
|
|
4005
4526
|
oracle.publicKey.startsWith("0x") ? oracle.publicKey.slice(2) : oracle.publicKey
|
|
4006
4527
|
);
|
|
4007
|
-
const signatureBytes = (0,
|
|
4528
|
+
const signatureBytes = (0, import_utils13.hexToBytes)(
|
|
4008
4529
|
signature.signature.startsWith("0x") ? signature.signature.slice(2) : signature.signature
|
|
4009
4530
|
);
|
|
4010
4531
|
return import_ed255192.ed25519.verify(signatureBytes, messageHash, publicKeyBytes);
|
|
@@ -4018,7 +4539,7 @@ function signAttestationMessage(messageHash, privateKey) {
|
|
|
4018
4539
|
const oracleId = deriveOracleId(publicKey);
|
|
4019
4540
|
return {
|
|
4020
4541
|
oracleId,
|
|
4021
|
-
signature: `0x${(0,
|
|
4542
|
+
signature: `0x${(0, import_utils13.bytesToHex)(signature)}`
|
|
4022
4543
|
};
|
|
4023
4544
|
}
|
|
4024
4545
|
function createOracleRegistry(config = {}) {
|
|
@@ -4070,14 +4591,14 @@ function hasEnoughOracles(registry) {
|
|
|
4070
4591
|
}
|
|
4071
4592
|
|
|
4072
4593
|
// src/index.ts
|
|
4073
|
-
var
|
|
4074
|
-
var
|
|
4075
|
-
var
|
|
4076
|
-
var
|
|
4594
|
+
var import_types55 = require("@sip-protocol/types");
|
|
4595
|
+
var import_types56 = require("@sip-protocol/types");
|
|
4596
|
+
var import_types57 = require("@sip-protocol/types");
|
|
4597
|
+
var import_types58 = require("@sip-protocol/types");
|
|
4077
4598
|
|
|
4078
4599
|
// src/solver/mock-solver.ts
|
|
4079
4600
|
var import_types7 = require("@sip-protocol/types");
|
|
4080
|
-
var
|
|
4601
|
+
var import_utils14 = require("@noble/hashes/utils");
|
|
4081
4602
|
var MockSolver = class {
|
|
4082
4603
|
info;
|
|
4083
4604
|
capabilities;
|
|
@@ -4159,7 +4680,7 @@ var MockSolver = class {
|
|
|
4159
4680
|
const spreadAmount = baseOutput * BigInt(Math.floor(this.spreadPercent * 1e4)) / 10000n;
|
|
4160
4681
|
const outputAmount = baseOutput + spreadAmount;
|
|
4161
4682
|
const feeAmount = outputAmount * BigInt(Math.floor(this.feePercent * 1e4)) / 10000n;
|
|
4162
|
-
const quoteId = `quote-${(0,
|
|
4683
|
+
const quoteId = `quote-${(0, import_utils14.bytesToHex)((0, import_utils14.randomBytes)(8))}`;
|
|
4163
4684
|
const now = Math.floor(Date.now() / 1e3);
|
|
4164
4685
|
const quote = {
|
|
4165
4686
|
quoteId,
|
|
@@ -4170,7 +4691,7 @@ var MockSolver = class {
|
|
|
4170
4691
|
expiry: now + 60,
|
|
4171
4692
|
// Quote valid for 1 minute
|
|
4172
4693
|
fee: feeAmount,
|
|
4173
|
-
signature: `0x${(0,
|
|
4694
|
+
signature: `0x${(0, import_utils14.bytesToHex)((0, import_utils14.randomBytes)(64))}`,
|
|
4174
4695
|
// Mock signature
|
|
4175
4696
|
validUntil: now + 60,
|
|
4176
4697
|
estimatedGas: 200000n
|
|
@@ -4207,7 +4728,7 @@ var MockSolver = class {
|
|
|
4207
4728
|
error: status.error
|
|
4208
4729
|
};
|
|
4209
4730
|
}
|
|
4210
|
-
const txHash = `0x${(0,
|
|
4731
|
+
const txHash = `0x${(0, import_utils14.bytesToHex)((0, import_utils14.randomBytes)(32))}`;
|
|
4211
4732
|
status.status = "completed";
|
|
4212
4733
|
status.txHash = txHash;
|
|
4213
4734
|
return {
|
|
@@ -4217,10 +4738,10 @@ var MockSolver = class {
|
|
|
4217
4738
|
txHash: intent.privacyLevel === "transparent" ? txHash : void 0,
|
|
4218
4739
|
fulfillmentProof: {
|
|
4219
4740
|
type: "fulfillment",
|
|
4220
|
-
proof: `0x${(0,
|
|
4741
|
+
proof: `0x${(0, import_utils14.bytesToHex)((0, import_utils14.randomBytes)(128))}`,
|
|
4221
4742
|
publicInputs: [
|
|
4222
|
-
`0x${(0,
|
|
4223
|
-
`0x${(0,
|
|
4743
|
+
`0x${(0, import_utils14.bytesToHex)(new TextEncoder().encode(intent.intentId))}`,
|
|
4744
|
+
`0x${(0, import_utils14.bytesToHex)(new TextEncoder().encode(quote.quoteId))}`
|
|
4224
4745
|
]
|
|
4225
4746
|
},
|
|
4226
4747
|
fulfilledAt: Math.floor(Date.now() / 1e3)
|
|
@@ -4258,7 +4779,7 @@ function createMockSolver(config) {
|
|
|
4258
4779
|
}
|
|
4259
4780
|
|
|
4260
4781
|
// src/index.ts
|
|
4261
|
-
var
|
|
4782
|
+
var import_types59 = require("@sip-protocol/types");
|
|
4262
4783
|
|
|
4263
4784
|
// src/settlement/interface.ts
|
|
4264
4785
|
var SwapStatus = /* @__PURE__ */ ((SwapStatus2) => {
|
|
@@ -5364,7 +5885,7 @@ function createZcashNativeBackend(config) {
|
|
|
5364
5885
|
|
|
5365
5886
|
// src/settlement/backends/direct-chain.ts
|
|
5366
5887
|
var import_types10 = require("@sip-protocol/types");
|
|
5367
|
-
var
|
|
5888
|
+
var import_utils15 = require("@noble/hashes/utils");
|
|
5368
5889
|
var DEFAULT_GAS_FEES = {
|
|
5369
5890
|
ethereum: 21000n * 50n * 1000000000n,
|
|
5370
5891
|
// 21k gas * 50 gwei = 0.00105 ETH
|
|
@@ -5382,8 +5903,24 @@ var DEFAULT_GAS_FEES = {
|
|
|
5382
5903
|
// 21k gas * 0.001 gwei ETH = 21 gwei = 21e6 wei
|
|
5383
5904
|
base: 2100000000n,
|
|
5384
5905
|
// 21k gas * 0.1 gwei ETH = 2100 gwei = 2.1e9 wei
|
|
5385
|
-
bitcoin: 10000n
|
|
5906
|
+
bitcoin: 10000n,
|
|
5386
5907
|
// 10000 sats = 0.0001 BTC (estimate for 1 input, 2 outputs)
|
|
5908
|
+
aptos: 100n,
|
|
5909
|
+
// 0.000001 APT in octas (gas units)
|
|
5910
|
+
sui: 1000n,
|
|
5911
|
+
// 0.000001 SUI in MIST
|
|
5912
|
+
cosmos: 5000n,
|
|
5913
|
+
// 0.005 ATOM in uatom
|
|
5914
|
+
osmosis: 5000n,
|
|
5915
|
+
// 0.005 OSMO in uosmo
|
|
5916
|
+
injective: 5000n,
|
|
5917
|
+
// 0.000005 INJ in inj (18 decimals)
|
|
5918
|
+
celestia: 5000n,
|
|
5919
|
+
// 0.005 TIA in utia
|
|
5920
|
+
sei: 5000n,
|
|
5921
|
+
// 0.005 SEI in usei
|
|
5922
|
+
dydx: 5000n
|
|
5923
|
+
// 0.000005 DYDX in dydx (18 decimals)
|
|
5387
5924
|
};
|
|
5388
5925
|
|
|
5389
5926
|
// src/zcash/rpc-client.ts
|
|
@@ -6668,12 +7205,300 @@ function createZcashSwapService(config) {
|
|
|
6668
7205
|
var import_types14 = require("@sip-protocol/types");
|
|
6669
7206
|
|
|
6670
7207
|
// src/index.ts
|
|
6671
|
-
var
|
|
7208
|
+
var import_types60 = require("@sip-protocol/types");
|
|
7209
|
+
|
|
7210
|
+
// src/bitcoin/taproot.ts
|
|
7211
|
+
var import_secp256k14 = require("@noble/curves/secp256k1");
|
|
7212
|
+
var import_sha25611 = require("@noble/hashes/sha256");
|
|
7213
|
+
var import_utils16 = require("@noble/hashes/utils");
|
|
7214
|
+
var BECH32_CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
|
|
7215
|
+
var BECH32_GENERATOR = [996825010, 642813549, 513874426, 1027748829, 705979059];
|
|
7216
|
+
function taggedHash(tag, data) {
|
|
7217
|
+
const tagHash = (0, import_sha25611.sha256)(new TextEncoder().encode(tag));
|
|
7218
|
+
const taggedData = new Uint8Array(tagHash.length * 2 + data.length);
|
|
7219
|
+
taggedData.set(tagHash, 0);
|
|
7220
|
+
taggedData.set(tagHash, tagHash.length);
|
|
7221
|
+
taggedData.set(data, tagHash.length * 2);
|
|
7222
|
+
return (0, import_sha25611.sha256)(taggedData);
|
|
7223
|
+
}
|
|
7224
|
+
function schnorrSign(message, privateKey, auxRand) {
|
|
7225
|
+
if (message.length !== 32) {
|
|
7226
|
+
throw new ValidationError("message must be 32 bytes", "message");
|
|
7227
|
+
}
|
|
7228
|
+
if (privateKey.length !== 32) {
|
|
7229
|
+
throw new ValidationError("privateKey must be 32 bytes", "privateKey");
|
|
7230
|
+
}
|
|
7231
|
+
if (auxRand && auxRand.length !== 32) {
|
|
7232
|
+
throw new ValidationError("auxRand must be 32 bytes if provided", "auxRand");
|
|
7233
|
+
}
|
|
7234
|
+
return import_secp256k14.schnorr.sign(message, privateKey, auxRand);
|
|
7235
|
+
}
|
|
7236
|
+
function schnorrVerify(signature, message, publicKey) {
|
|
7237
|
+
if (signature.length !== 64) {
|
|
7238
|
+
throw new ValidationError("signature must be 64 bytes", "signature");
|
|
7239
|
+
}
|
|
7240
|
+
if (message.length !== 32) {
|
|
7241
|
+
throw new ValidationError("message must be 32 bytes", "message");
|
|
7242
|
+
}
|
|
7243
|
+
if (publicKey.length !== 32) {
|
|
7244
|
+
throw new ValidationError("publicKey must be 32 bytes (x-only)", "publicKey");
|
|
7245
|
+
}
|
|
7246
|
+
try {
|
|
7247
|
+
return import_secp256k14.schnorr.verify(signature, message, publicKey);
|
|
7248
|
+
} catch {
|
|
7249
|
+
return false;
|
|
7250
|
+
}
|
|
7251
|
+
}
|
|
7252
|
+
function getXOnlyPublicKey(privateKey) {
|
|
7253
|
+
if (privateKey.length !== 32) {
|
|
7254
|
+
throw new ValidationError("privateKey must be 32 bytes", "privateKey");
|
|
7255
|
+
}
|
|
7256
|
+
const publicKey = import_secp256k14.secp256k1.getPublicKey(privateKey, false);
|
|
7257
|
+
return publicKey.slice(1, 33);
|
|
7258
|
+
}
|
|
7259
|
+
function computeTweakedKey(internalKey, merkleRoot) {
|
|
7260
|
+
if (internalKey.length !== 32) {
|
|
7261
|
+
throw new ValidationError("internalKey must be 32 bytes (x-only)", "internalKey");
|
|
7262
|
+
}
|
|
7263
|
+
if (merkleRoot && merkleRoot.length !== 32) {
|
|
7264
|
+
throw new ValidationError("merkleRoot must be 32 bytes if provided", "merkleRoot");
|
|
7265
|
+
}
|
|
7266
|
+
const tweakData = merkleRoot ? new Uint8Array([...internalKey, ...merkleRoot]) : internalKey;
|
|
7267
|
+
const tweak = taggedHash("TapTweak", tweakData);
|
|
7268
|
+
const tweakScalar = BigInt("0x" + (0, import_utils16.bytesToHex)(tweak)) % import_secp256k14.secp256k1.CURVE.n;
|
|
7269
|
+
const internalPoint = import_secp256k14.secp256k1.ProjectivePoint.fromHex(
|
|
7270
|
+
"02" + (0, import_utils16.bytesToHex)(internalKey)
|
|
7271
|
+
);
|
|
7272
|
+
const tweakPoint = import_secp256k14.secp256k1.ProjectivePoint.BASE.multiply(tweakScalar);
|
|
7273
|
+
const tweakedPoint = internalPoint.add(tweakPoint);
|
|
7274
|
+
const tweakedKeyBytes = tweakedPoint.toRawBytes(false);
|
|
7275
|
+
const xOnly = tweakedKeyBytes.slice(1, 33);
|
|
7276
|
+
const yCoord = tweakedKeyBytes.slice(33, 65);
|
|
7277
|
+
const yBigInt = BigInt("0x" + (0, import_utils16.bytesToHex)(yCoord));
|
|
7278
|
+
const parity = Number(yBigInt & 1n);
|
|
7279
|
+
return {
|
|
7280
|
+
tweakedKey: xOnly,
|
|
7281
|
+
parity
|
|
7282
|
+
};
|
|
7283
|
+
}
|
|
7284
|
+
function createTaprootOutput(internalKey, scripts) {
|
|
7285
|
+
if (internalKey.length !== 32) {
|
|
7286
|
+
throw new ValidationError("internalKey must be 32 bytes (x-only)", "internalKey");
|
|
7287
|
+
}
|
|
7288
|
+
let merkleRoot;
|
|
7289
|
+
if (scripts && scripts.length > 0) {
|
|
7290
|
+
if (scripts.length === 1) {
|
|
7291
|
+
const script = scripts[0];
|
|
7292
|
+
const leafData = new Uint8Array([
|
|
7293
|
+
script.leafVersion,
|
|
7294
|
+
script.script.length,
|
|
7295
|
+
...script.script
|
|
7296
|
+
]);
|
|
7297
|
+
merkleRoot = taggedHash("TapLeaf", leafData);
|
|
7298
|
+
} else {
|
|
7299
|
+
throw new ValidationError(
|
|
7300
|
+
"Multiple tapscripts not yet implemented - use single script or no scripts",
|
|
7301
|
+
"scripts"
|
|
7302
|
+
);
|
|
7303
|
+
}
|
|
7304
|
+
}
|
|
7305
|
+
const { tweakedKey, parity } = computeTweakedKey(internalKey, merkleRoot);
|
|
7306
|
+
return {
|
|
7307
|
+
tweakedKey: `0x${(0, import_utils16.bytesToHex)(tweakedKey)}`,
|
|
7308
|
+
internalKey: `0x${(0, import_utils16.bytesToHex)(internalKey)}`,
|
|
7309
|
+
merkleRoot: merkleRoot ? `0x${(0, import_utils16.bytesToHex)(merkleRoot)}` : void 0,
|
|
7310
|
+
parity
|
|
7311
|
+
};
|
|
7312
|
+
}
|
|
7313
|
+
function bech32Polymod(values) {
|
|
7314
|
+
let chk = 1;
|
|
7315
|
+
for (const value of values) {
|
|
7316
|
+
const top = chk >> 25;
|
|
7317
|
+
chk = (chk & 33554431) << 5 ^ value;
|
|
7318
|
+
for (let i = 0; i < 5; i++) {
|
|
7319
|
+
if (top >> i & 1) {
|
|
7320
|
+
chk ^= BECH32_GENERATOR[i];
|
|
7321
|
+
}
|
|
7322
|
+
}
|
|
7323
|
+
}
|
|
7324
|
+
return chk;
|
|
7325
|
+
}
|
|
7326
|
+
function bech32HrpExpand(hrp) {
|
|
7327
|
+
const result = [];
|
|
7328
|
+
for (let i = 0; i < hrp.length; i++) {
|
|
7329
|
+
result.push(hrp.charCodeAt(i) >> 5);
|
|
7330
|
+
}
|
|
7331
|
+
result.push(0);
|
|
7332
|
+
for (let i = 0; i < hrp.length; i++) {
|
|
7333
|
+
result.push(hrp.charCodeAt(i) & 31);
|
|
7334
|
+
}
|
|
7335
|
+
return result;
|
|
7336
|
+
}
|
|
7337
|
+
function bech32VerifyChecksum(hrp, data) {
|
|
7338
|
+
return bech32Polymod([...bech32HrpExpand(hrp), ...data]) === 734539939;
|
|
7339
|
+
}
|
|
7340
|
+
function bech32CreateChecksum(hrp, data) {
|
|
7341
|
+
const values = [...bech32HrpExpand(hrp), ...data, 0, 0, 0, 0, 0, 0];
|
|
7342
|
+
const polymod = bech32Polymod(values) ^ 734539939;
|
|
7343
|
+
const checksum = [];
|
|
7344
|
+
for (let i = 0; i < 6; i++) {
|
|
7345
|
+
checksum.push(polymod >> 5 * (5 - i) & 31);
|
|
7346
|
+
}
|
|
7347
|
+
return checksum;
|
|
7348
|
+
}
|
|
7349
|
+
function convertBits(data, fromBits, toBits, pad) {
|
|
7350
|
+
let acc = 0;
|
|
7351
|
+
let bits = 0;
|
|
7352
|
+
const result = [];
|
|
7353
|
+
const maxv = (1 << toBits) - 1;
|
|
7354
|
+
for (const value of data) {
|
|
7355
|
+
if (value < 0 || value >> fromBits !== 0) {
|
|
7356
|
+
return null;
|
|
7357
|
+
}
|
|
7358
|
+
acc = acc << fromBits | value;
|
|
7359
|
+
bits += fromBits;
|
|
7360
|
+
while (bits >= toBits) {
|
|
7361
|
+
bits -= toBits;
|
|
7362
|
+
result.push(acc >> bits & maxv);
|
|
7363
|
+
}
|
|
7364
|
+
}
|
|
7365
|
+
if (pad) {
|
|
7366
|
+
if (bits > 0) {
|
|
7367
|
+
result.push(acc << toBits - bits & maxv);
|
|
7368
|
+
}
|
|
7369
|
+
} else if (bits >= fromBits || acc << toBits - bits & maxv) {
|
|
7370
|
+
return null;
|
|
7371
|
+
}
|
|
7372
|
+
return result;
|
|
7373
|
+
}
|
|
7374
|
+
function taprootAddress(tweakedKey, network = "mainnet") {
|
|
7375
|
+
if (tweakedKey.length !== 32) {
|
|
7376
|
+
throw new ValidationError("tweakedKey must be 32 bytes", "tweakedKey");
|
|
7377
|
+
}
|
|
7378
|
+
const hrp = network === "mainnet" ? "bc" : network === "testnet" ? "tb" : "bcrt";
|
|
7379
|
+
const version = 1;
|
|
7380
|
+
const words = convertBits(tweakedKey, 8, 5, true);
|
|
7381
|
+
if (!words) {
|
|
7382
|
+
throw new ValidationError("Failed to convert tweaked key to bech32 format", "tweakedKey");
|
|
7383
|
+
}
|
|
7384
|
+
const data = [version, ...words];
|
|
7385
|
+
const checksum = bech32CreateChecksum(hrp, data);
|
|
7386
|
+
const combined = [...data, ...checksum];
|
|
7387
|
+
let result = hrp + "1";
|
|
7388
|
+
for (const value of combined) {
|
|
7389
|
+
result += BECH32_CHARSET[value];
|
|
7390
|
+
}
|
|
7391
|
+
return result;
|
|
7392
|
+
}
|
|
7393
|
+
function decodeTaprootAddress(address) {
|
|
7394
|
+
if (typeof address !== "string" || address.length < 14 || address.length > 90) {
|
|
7395
|
+
throw new ValidationError("Invalid Taproot address format", "address");
|
|
7396
|
+
}
|
|
7397
|
+
const addressLower = address.toLowerCase();
|
|
7398
|
+
const sepIndex = addressLower.lastIndexOf("1");
|
|
7399
|
+
if (sepIndex === -1 || sepIndex + 7 > addressLower.length) {
|
|
7400
|
+
throw new ValidationError("Invalid Taproot address: no separator", "address");
|
|
7401
|
+
}
|
|
7402
|
+
const hrp = addressLower.slice(0, sepIndex);
|
|
7403
|
+
const dataStr = addressLower.slice(sepIndex + 1);
|
|
7404
|
+
let network;
|
|
7405
|
+
if (hrp === "bc") {
|
|
7406
|
+
network = "mainnet";
|
|
7407
|
+
} else if (hrp === "tb") {
|
|
7408
|
+
network = "testnet";
|
|
7409
|
+
} else if (hrp === "bcrt") {
|
|
7410
|
+
network = "regtest";
|
|
7411
|
+
} else {
|
|
7412
|
+
throw new ValidationError(`Unknown HRP: ${hrp}`, "address");
|
|
7413
|
+
}
|
|
7414
|
+
const data = [];
|
|
7415
|
+
for (const char of dataStr) {
|
|
7416
|
+
const index = BECH32_CHARSET.indexOf(char);
|
|
7417
|
+
if (index === -1) {
|
|
7418
|
+
throw new ValidationError(`Invalid bech32 character: ${char}`, "address");
|
|
7419
|
+
}
|
|
7420
|
+
data.push(index);
|
|
7421
|
+
}
|
|
7422
|
+
if (!bech32VerifyChecksum(hrp, data)) {
|
|
7423
|
+
throw new ValidationError("Invalid Taproot address checksum", "address");
|
|
7424
|
+
}
|
|
7425
|
+
const version = data[0];
|
|
7426
|
+
if (version !== 1) {
|
|
7427
|
+
throw new ValidationError(`Expected witness version 1 (Taproot), got ${version}`, "address");
|
|
7428
|
+
}
|
|
7429
|
+
const program = convertBits(new Uint8Array(data.slice(1, -6)), 5, 8, false);
|
|
7430
|
+
if (!program || program.length !== 32) {
|
|
7431
|
+
throw new ValidationError("Invalid Taproot program length", "address");
|
|
7432
|
+
}
|
|
7433
|
+
return {
|
|
7434
|
+
tweakedKey: new Uint8Array(program),
|
|
7435
|
+
network
|
|
7436
|
+
};
|
|
7437
|
+
}
|
|
7438
|
+
function createKeySpendOnlyOutput(privateKey, network = "mainnet") {
|
|
7439
|
+
if (!isValidPrivateKey(privateKey)) {
|
|
7440
|
+
throw new ValidationError("privateKey must be a valid 32-byte hex string", "privateKey");
|
|
7441
|
+
}
|
|
7442
|
+
const privKeyBytes = (0, import_utils16.hexToBytes)(privateKey.slice(2));
|
|
7443
|
+
const internalKey = getXOnlyPublicKey(privKeyBytes);
|
|
7444
|
+
const output = createTaprootOutput(internalKey);
|
|
7445
|
+
const tweakedKeyBytes = (0, import_utils16.hexToBytes)(output.tweakedKey.slice(2));
|
|
7446
|
+
const address = taprootAddress(tweakedKeyBytes, network);
|
|
7447
|
+
return {
|
|
7448
|
+
output,
|
|
7449
|
+
address,
|
|
7450
|
+
internalPrivateKey: privateKey
|
|
7451
|
+
};
|
|
7452
|
+
}
|
|
7453
|
+
function isValidTaprootAddress(address) {
|
|
7454
|
+
try {
|
|
7455
|
+
decodeTaprootAddress(address);
|
|
7456
|
+
return true;
|
|
7457
|
+
} catch {
|
|
7458
|
+
return false;
|
|
7459
|
+
}
|
|
7460
|
+
}
|
|
7461
|
+
function schnorrSignHex(message, privateKey, auxRand) {
|
|
7462
|
+
if (!isValidHex(message)) {
|
|
7463
|
+
throw new ValidationError("message must be a hex string", "message");
|
|
7464
|
+
}
|
|
7465
|
+
if (!isValidPrivateKey(privateKey)) {
|
|
7466
|
+
throw new ValidationError("privateKey must be a valid 32-byte hex string", "privateKey");
|
|
7467
|
+
}
|
|
7468
|
+
if (auxRand && !isValidHex(auxRand)) {
|
|
7469
|
+
throw new ValidationError("auxRand must be a hex string", "auxRand");
|
|
7470
|
+
}
|
|
7471
|
+
const messageBytes = (0, import_utils16.hexToBytes)(message.slice(2));
|
|
7472
|
+
const privateKeyBytes = (0, import_utils16.hexToBytes)(privateKey.slice(2));
|
|
7473
|
+
const auxRandBytes = auxRand ? (0, import_utils16.hexToBytes)(auxRand.slice(2)) : void 0;
|
|
7474
|
+
const signature = schnorrSign(messageBytes, privateKeyBytes, auxRandBytes);
|
|
7475
|
+
return `0x${(0, import_utils16.bytesToHex)(signature)}`;
|
|
7476
|
+
}
|
|
7477
|
+
function schnorrVerifyHex(signature, message, publicKey) {
|
|
7478
|
+
if (!isValidHex(signature)) {
|
|
7479
|
+
throw new ValidationError("signature must be a hex string", "signature");
|
|
7480
|
+
}
|
|
7481
|
+
if (!isValidHex(message)) {
|
|
7482
|
+
throw new ValidationError("message must be a hex string", "message");
|
|
7483
|
+
}
|
|
7484
|
+
if (!isValidHex(publicKey)) {
|
|
7485
|
+
throw new ValidationError("publicKey must be a hex string", "publicKey");
|
|
7486
|
+
}
|
|
7487
|
+
const signatureBytes = (0, import_utils16.hexToBytes)(signature.slice(2));
|
|
7488
|
+
const messageBytes = (0, import_utils16.hexToBytes)(message.slice(2));
|
|
7489
|
+
const publicKeyBytes = (0, import_utils16.hexToBytes)(publicKey.slice(2));
|
|
7490
|
+
return schnorrVerify(signatureBytes, messageBytes, publicKeyBytes);
|
|
7491
|
+
}
|
|
7492
|
+
|
|
7493
|
+
// src/bitcoin/silent-payments.ts
|
|
7494
|
+
var import_secp256k15 = require("@noble/curves/secp256k1");
|
|
7495
|
+
var import_sha25612 = require("@noble/hashes/sha256");
|
|
7496
|
+
var import_utils17 = require("@noble/hashes/utils");
|
|
6672
7497
|
|
|
6673
7498
|
// src/payment/payment.ts
|
|
6674
7499
|
var import_types15 = require("@sip-protocol/types");
|
|
6675
|
-
var
|
|
6676
|
-
var
|
|
7500
|
+
var import_sha25613 = require("@noble/hashes/sha256");
|
|
7501
|
+
var import_utils18 = require("@noble/hashes/utils");
|
|
6677
7502
|
var import_chacha2 = require("@noble/ciphers/chacha.js");
|
|
6678
7503
|
var import_hkdf2 = require("@noble/hashes/hkdf");
|
|
6679
7504
|
|
|
@@ -7169,8 +7994,8 @@ async function createShieldedPayment(params, options) {
|
|
|
7169
7994
|
let viewingKeyHash;
|
|
7170
7995
|
if (viewingKey) {
|
|
7171
7996
|
const keyHex = viewingKey.startsWith("0x") ? viewingKey.slice(2) : viewingKey;
|
|
7172
|
-
const keyBytes = (0,
|
|
7173
|
-
viewingKeyHash = `0x${(0,
|
|
7997
|
+
const keyBytes = (0, import_utils18.hexToBytes)(keyHex);
|
|
7998
|
+
viewingKeyHash = `0x${(0, import_utils18.bytesToHex)((0, import_sha25613.sha256)(keyBytes))}`;
|
|
7174
7999
|
}
|
|
7175
8000
|
const privacyConfig = getPrivacyConfig(
|
|
7176
8001
|
privacy,
|
|
@@ -7210,7 +8035,7 @@ async function createShieldedPayment(params, options) {
|
|
|
7210
8035
|
if (privacy !== import_types15.PrivacyLevel.TRANSPARENT && proofProvider?.isReady) {
|
|
7211
8036
|
const hexToUint8 = (hex) => {
|
|
7212
8037
|
const cleanHex = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
7213
|
-
return (0,
|
|
8038
|
+
return (0, import_utils18.hexToBytes)(cleanHex);
|
|
7214
8039
|
};
|
|
7215
8040
|
const fundingResult = await proofProvider.generateFundingProof({
|
|
7216
8041
|
balance: amount,
|
|
@@ -7237,17 +8062,17 @@ async function createShieldedPayment(params, options) {
|
|
|
7237
8062
|
}
|
|
7238
8063
|
function encryptMemo(memo, viewingKey) {
|
|
7239
8064
|
const keyHex = viewingKey.startsWith("0x") ? viewingKey.slice(2) : viewingKey;
|
|
7240
|
-
const keyBytes = (0,
|
|
7241
|
-
const encKey = (0, import_hkdf2.hkdf)(
|
|
8065
|
+
const keyBytes = (0, import_utils18.hexToBytes)(keyHex);
|
|
8066
|
+
const encKey = (0, import_hkdf2.hkdf)(import_sha25613.sha256, keyBytes, new Uint8Array(0), new Uint8Array(0), 32);
|
|
7242
8067
|
try {
|
|
7243
|
-
const nonce = (0,
|
|
8068
|
+
const nonce = (0, import_utils18.randomBytes)(24);
|
|
7244
8069
|
const cipher = (0, import_chacha2.xchacha20poly1305)(encKey, nonce);
|
|
7245
8070
|
const plaintext = new TextEncoder().encode(memo);
|
|
7246
8071
|
const ciphertext = cipher.encrypt(plaintext);
|
|
7247
8072
|
const result = new Uint8Array(nonce.length + ciphertext.length);
|
|
7248
8073
|
result.set(nonce);
|
|
7249
8074
|
result.set(ciphertext, nonce.length);
|
|
7250
|
-
return `0x${(0,
|
|
8075
|
+
return `0x${(0, import_utils18.bytesToHex)(result)}`;
|
|
7251
8076
|
} finally {
|
|
7252
8077
|
secureWipe(keyBytes);
|
|
7253
8078
|
secureWipe(encKey);
|
|
@@ -7255,11 +8080,11 @@ function encryptMemo(memo, viewingKey) {
|
|
|
7255
8080
|
}
|
|
7256
8081
|
function decryptMemo(encryptedMemo, viewingKey) {
|
|
7257
8082
|
const keyHex = viewingKey.startsWith("0x") ? viewingKey.slice(2) : viewingKey;
|
|
7258
|
-
const keyBytes = (0,
|
|
7259
|
-
const encKey = (0, import_hkdf2.hkdf)(
|
|
8083
|
+
const keyBytes = (0, import_utils18.hexToBytes)(keyHex);
|
|
8084
|
+
const encKey = (0, import_hkdf2.hkdf)(import_sha25613.sha256, keyBytes, new Uint8Array(0), new Uint8Array(0), 32);
|
|
7260
8085
|
try {
|
|
7261
8086
|
const dataHex = encryptedMemo.startsWith("0x") ? encryptedMemo.slice(2) : encryptedMemo;
|
|
7262
|
-
const data = (0,
|
|
8087
|
+
const data = (0, import_utils18.hexToBytes)(dataHex);
|
|
7263
8088
|
const nonce = data.slice(0, 24);
|
|
7264
8089
|
const ciphertext = data.slice(24);
|
|
7265
8090
|
const cipher = (0, import_chacha2.xchacha20poly1305)(encKey, nonce);
|
|
@@ -7307,9 +8132,9 @@ function getPaymentSummary(payment) {
|
|
|
7307
8132
|
|
|
7308
8133
|
// src/treasury/treasury.ts
|
|
7309
8134
|
var import_types16 = require("@sip-protocol/types");
|
|
7310
|
-
var
|
|
7311
|
-
var
|
|
7312
|
-
var
|
|
8135
|
+
var import_secp256k16 = require("@noble/curves/secp256k1");
|
|
8136
|
+
var import_sha25614 = require("@noble/hashes/sha256");
|
|
8137
|
+
var import_utils19 = require("@noble/hashes/utils");
|
|
7313
8138
|
var DEFAULT_PROPOSAL_TTL = 7 * 24 * 60 * 60;
|
|
7314
8139
|
var Treasury = class _Treasury {
|
|
7315
8140
|
config;
|
|
@@ -7800,12 +8625,12 @@ var Treasury = class _Treasury {
|
|
|
7800
8625
|
}
|
|
7801
8626
|
};
|
|
7802
8627
|
function generateTreasuryId() {
|
|
7803
|
-
const bytes = (0,
|
|
7804
|
-
return `treasury_${(0,
|
|
8628
|
+
const bytes = (0, import_utils19.randomBytes)(16);
|
|
8629
|
+
return `treasury_${(0, import_utils19.bytesToHex)(bytes)}`;
|
|
7805
8630
|
}
|
|
7806
8631
|
function generateProposalId() {
|
|
7807
|
-
const bytes = (0,
|
|
7808
|
-
return `prop_${(0,
|
|
8632
|
+
const bytes = (0, import_utils19.randomBytes)(16);
|
|
8633
|
+
return `prop_${(0, import_utils19.bytesToHex)(bytes)}`;
|
|
7809
8634
|
}
|
|
7810
8635
|
function computeProposalHash(proposal) {
|
|
7811
8636
|
const data = JSON.stringify({
|
|
@@ -7817,13 +8642,13 @@ function computeProposalHash(proposal) {
|
|
|
7817
8642
|
createdAt: proposal.createdAt,
|
|
7818
8643
|
expiresAt: proposal.expiresAt
|
|
7819
8644
|
}, (_, value) => typeof value === "bigint" ? value.toString() : value);
|
|
7820
|
-
return (0,
|
|
8645
|
+
return (0, import_sha25614.sha256)(new TextEncoder().encode(data));
|
|
7821
8646
|
}
|
|
7822
8647
|
function signMessage(messageHash, privateKey) {
|
|
7823
8648
|
const keyHex = privateKey.startsWith("0x") ? privateKey.slice(2) : privateKey;
|
|
7824
|
-
const keyBytes = (0,
|
|
8649
|
+
const keyBytes = (0, import_utils19.hexToBytes)(keyHex);
|
|
7825
8650
|
try {
|
|
7826
|
-
const signature =
|
|
8651
|
+
const signature = import_secp256k16.secp256k1.sign(messageHash, keyBytes);
|
|
7827
8652
|
return `0x${signature.toCompactHex()}`;
|
|
7828
8653
|
} finally {
|
|
7829
8654
|
secureWipe(keyBytes);
|
|
@@ -7833,9 +8658,9 @@ function verifySignature(messageHash, signature, publicKey) {
|
|
|
7833
8658
|
const sigHex = signature.startsWith("0x") ? signature.slice(2) : signature;
|
|
7834
8659
|
const pubKeyHex = publicKey.startsWith("0x") ? publicKey.slice(2) : publicKey;
|
|
7835
8660
|
try {
|
|
7836
|
-
const sigBytes = (0,
|
|
7837
|
-
const pubKeyBytes = (0,
|
|
7838
|
-
return
|
|
8661
|
+
const sigBytes = (0, import_utils19.hexToBytes)(sigHex);
|
|
8662
|
+
const pubKeyBytes = (0, import_utils19.hexToBytes)(pubKeyHex);
|
|
8663
|
+
return import_secp256k16.secp256k1.verify(sigBytes, messageHash, pubKeyBytes);
|
|
7839
8664
|
} catch {
|
|
7840
8665
|
return false;
|
|
7841
8666
|
}
|
|
@@ -7993,7 +8818,7 @@ function validateBatchProposalParams(params, config) {
|
|
|
7993
8818
|
|
|
7994
8819
|
// src/compliance/compliance-manager.ts
|
|
7995
8820
|
var import_types17 = require("@sip-protocol/types");
|
|
7996
|
-
var
|
|
8821
|
+
var import_utils20 = require("@noble/hashes/utils");
|
|
7997
8822
|
var DEFAULTS2 = {
|
|
7998
8823
|
riskThreshold: 70,
|
|
7999
8824
|
highValueThreshold: 10000000000n,
|
|
@@ -8667,7 +9492,7 @@ var ComplianceManager = class _ComplianceManager {
|
|
|
8667
9492
|
}
|
|
8668
9493
|
};
|
|
8669
9494
|
function generateId(prefix) {
|
|
8670
|
-
return `${prefix}_${(0,
|
|
9495
|
+
return `${prefix}_${(0, import_utils20.bytesToHex)((0, import_utils20.randomBytes)(12))}`;
|
|
8671
9496
|
}
|
|
8672
9497
|
function validateRegisterAuditorParams(params) {
|
|
8673
9498
|
if (!params.organization?.trim()) {
|
|
@@ -10911,6 +11736,30 @@ function createMockEthereumProvider(config = {}) {
|
|
|
10911
11736
|
return provider;
|
|
10912
11737
|
}
|
|
10913
11738
|
|
|
11739
|
+
// src/wallet/cosmos/adapter.ts
|
|
11740
|
+
var import_types29 = require("@sip-protocol/types");
|
|
11741
|
+
|
|
11742
|
+
// src/wallet/cosmos/mock.ts
|
|
11743
|
+
var import_types31 = require("@sip-protocol/types");
|
|
11744
|
+
|
|
11745
|
+
// src/wallet/bitcoin/adapter.ts
|
|
11746
|
+
var import_types34 = require("@sip-protocol/types");
|
|
11747
|
+
|
|
11748
|
+
// src/wallet/bitcoin/mock.ts
|
|
11749
|
+
var import_types36 = require("@sip-protocol/types");
|
|
11750
|
+
|
|
11751
|
+
// src/wallet/aptos/adapter.ts
|
|
11752
|
+
var import_types39 = require("@sip-protocol/types");
|
|
11753
|
+
|
|
11754
|
+
// src/wallet/aptos/mock.ts
|
|
11755
|
+
var import_types41 = require("@sip-protocol/types");
|
|
11756
|
+
|
|
11757
|
+
// src/wallet/sui/adapter.ts
|
|
11758
|
+
var import_types43 = require("@sip-protocol/types");
|
|
11759
|
+
|
|
11760
|
+
// src/wallet/sui/mock.ts
|
|
11761
|
+
var import_types45 = require("@sip-protocol/types");
|
|
11762
|
+
|
|
10914
11763
|
// src/wallet/hardware/types.ts
|
|
10915
11764
|
var DerivationPath = {
|
|
10916
11765
|
/** Ethereum: m/44'/60'/0'/0/index */
|
|
@@ -10986,7 +11835,7 @@ function getAvailableTransports() {
|
|
|
10986
11835
|
}
|
|
10987
11836
|
|
|
10988
11837
|
// src/wallet/hardware/ledger.ts
|
|
10989
|
-
var
|
|
11838
|
+
var import_types47 = require("@sip-protocol/types");
|
|
10990
11839
|
var LedgerWalletAdapter = class extends BaseWalletAdapter {
|
|
10991
11840
|
chain;
|
|
10992
11841
|
name = "ledger";
|
|
@@ -11139,7 +11988,7 @@ var LedgerWalletAdapter = class extends BaseWalletAdapter {
|
|
|
11139
11988
|
async getBalance() {
|
|
11140
11989
|
throw new WalletError(
|
|
11141
11990
|
"Hardware wallets do not track balances. Use an RPC provider.",
|
|
11142
|
-
|
|
11991
|
+
import_types47.WalletErrorCode.UNSUPPORTED_OPERATION
|
|
11143
11992
|
);
|
|
11144
11993
|
}
|
|
11145
11994
|
/**
|
|
@@ -11150,7 +11999,7 @@ var LedgerWalletAdapter = class extends BaseWalletAdapter {
|
|
|
11150
11999
|
async getTokenBalance(_asset) {
|
|
11151
12000
|
throw new WalletError(
|
|
11152
12001
|
"Hardware wallets do not track balances. Use an RPC provider.",
|
|
11153
|
-
|
|
12002
|
+
import_types47.WalletErrorCode.UNSUPPORTED_OPERATION
|
|
11154
12003
|
);
|
|
11155
12004
|
}
|
|
11156
12005
|
// ─── Account Management ─────────────────────────────────────────────────────
|
|
@@ -11438,7 +12287,7 @@ function createLedgerAdapter(config) {
|
|
|
11438
12287
|
}
|
|
11439
12288
|
|
|
11440
12289
|
// src/wallet/hardware/trezor.ts
|
|
11441
|
-
var
|
|
12290
|
+
var import_types49 = require("@sip-protocol/types");
|
|
11442
12291
|
var TrezorWalletAdapter = class extends BaseWalletAdapter {
|
|
11443
12292
|
chain;
|
|
11444
12293
|
name = "trezor";
|
|
@@ -11584,7 +12433,7 @@ var TrezorWalletAdapter = class extends BaseWalletAdapter {
|
|
|
11584
12433
|
async getBalance() {
|
|
11585
12434
|
throw new WalletError(
|
|
11586
12435
|
"Hardware wallets do not track balances. Use an RPC provider.",
|
|
11587
|
-
|
|
12436
|
+
import_types49.WalletErrorCode.UNSUPPORTED_OPERATION
|
|
11588
12437
|
);
|
|
11589
12438
|
}
|
|
11590
12439
|
/**
|
|
@@ -11595,7 +12444,7 @@ var TrezorWalletAdapter = class extends BaseWalletAdapter {
|
|
|
11595
12444
|
async getTokenBalance(_asset) {
|
|
11596
12445
|
throw new WalletError(
|
|
11597
12446
|
"Hardware wallets do not track balances. Use an RPC provider.",
|
|
11598
|
-
|
|
12447
|
+
import_types49.WalletErrorCode.UNSUPPORTED_OPERATION
|
|
11599
12448
|
);
|
|
11600
12449
|
}
|
|
11601
12450
|
// ─── Account Management ─────────────────────────────────────────────────────
|
|
@@ -11876,8 +12725,8 @@ function createTrezorAdapter(config) {
|
|
|
11876
12725
|
}
|
|
11877
12726
|
|
|
11878
12727
|
// src/wallet/hardware/mock.ts
|
|
11879
|
-
var
|
|
11880
|
-
var
|
|
12728
|
+
var import_types51 = require("@sip-protocol/types");
|
|
12729
|
+
var import_utils21 = require("@noble/hashes/utils");
|
|
11881
12730
|
var MockLedgerAdapter = class extends BaseWalletAdapter {
|
|
11882
12731
|
chain;
|
|
11883
12732
|
name = "mock-ledger";
|
|
@@ -12024,7 +12873,7 @@ var MockLedgerAdapter = class extends BaseWalletAdapter {
|
|
|
12024
12873
|
async getBalance() {
|
|
12025
12874
|
throw new WalletError(
|
|
12026
12875
|
"Hardware wallets do not track balances",
|
|
12027
|
-
|
|
12876
|
+
import_types51.WalletErrorCode.UNSUPPORTED_OPERATION
|
|
12028
12877
|
);
|
|
12029
12878
|
}
|
|
12030
12879
|
/**
|
|
@@ -12033,7 +12882,7 @@ var MockLedgerAdapter = class extends BaseWalletAdapter {
|
|
|
12033
12882
|
async getTokenBalance(_asset) {
|
|
12034
12883
|
throw new WalletError(
|
|
12035
12884
|
"Hardware wallets do not track balances",
|
|
12036
|
-
|
|
12885
|
+
import_types51.WalletErrorCode.UNSUPPORTED_OPERATION
|
|
12037
12886
|
);
|
|
12038
12887
|
}
|
|
12039
12888
|
/**
|
|
@@ -12122,15 +12971,15 @@ var MockLedgerAdapter = class extends BaseWalletAdapter {
|
|
|
12122
12971
|
}
|
|
12123
12972
|
}
|
|
12124
12973
|
generateMockAddress(index) {
|
|
12125
|
-
const bytes = (0,
|
|
12974
|
+
const bytes = (0, import_utils21.randomBytes)(20);
|
|
12126
12975
|
bytes[0] = index;
|
|
12127
|
-
return `0x${(0,
|
|
12976
|
+
return `0x${(0, import_utils21.bytesToHex)(bytes)}`;
|
|
12128
12977
|
}
|
|
12129
12978
|
generateMockPublicKey(index) {
|
|
12130
|
-
const bytes = (0,
|
|
12979
|
+
const bytes = (0, import_utils21.randomBytes)(33);
|
|
12131
12980
|
bytes[0] = 2;
|
|
12132
12981
|
bytes[1] = index;
|
|
12133
|
-
return `0x${(0,
|
|
12982
|
+
return `0x${(0, import_utils21.bytesToHex)(bytes)}`;
|
|
12134
12983
|
}
|
|
12135
12984
|
generateMockSignature(data) {
|
|
12136
12985
|
const sig = new Uint8Array(65);
|
|
@@ -12139,7 +12988,7 @@ var MockLedgerAdapter = class extends BaseWalletAdapter {
|
|
|
12139
12988
|
sig[32 + i] = (data[i % data.length] ?? 0) ^ i * 11;
|
|
12140
12989
|
}
|
|
12141
12990
|
sig[64] = 27;
|
|
12142
|
-
return `0x${(0,
|
|
12991
|
+
return `0x${(0, import_utils21.bytesToHex)(sig)}`;
|
|
12143
12992
|
}
|
|
12144
12993
|
delay(ms) {
|
|
12145
12994
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -12263,13 +13112,13 @@ var MockTrezorAdapter = class extends BaseWalletAdapter {
|
|
|
12263
13112
|
async getBalance() {
|
|
12264
13113
|
throw new WalletError(
|
|
12265
13114
|
"Hardware wallets do not track balances",
|
|
12266
|
-
|
|
13115
|
+
import_types51.WalletErrorCode.UNSUPPORTED_OPERATION
|
|
12267
13116
|
);
|
|
12268
13117
|
}
|
|
12269
13118
|
async getTokenBalance(_asset) {
|
|
12270
13119
|
throw new WalletError(
|
|
12271
13120
|
"Hardware wallets do not track balances",
|
|
12272
|
-
|
|
13121
|
+
import_types51.WalletErrorCode.UNSUPPORTED_OPERATION
|
|
12273
13122
|
);
|
|
12274
13123
|
}
|
|
12275
13124
|
async getAccounts(startIndex = 0, count = 5) {
|
|
@@ -12328,15 +13177,15 @@ var MockTrezorAdapter = class extends BaseWalletAdapter {
|
|
|
12328
13177
|
}
|
|
12329
13178
|
}
|
|
12330
13179
|
generateMockAddress(index) {
|
|
12331
|
-
const bytes = (0,
|
|
13180
|
+
const bytes = (0, import_utils21.randomBytes)(20);
|
|
12332
13181
|
bytes[0] = index + 100;
|
|
12333
|
-
return `0x${(0,
|
|
13182
|
+
return `0x${(0, import_utils21.bytesToHex)(bytes)}`;
|
|
12334
13183
|
}
|
|
12335
13184
|
generateMockPublicKey(index) {
|
|
12336
|
-
const bytes = (0,
|
|
13185
|
+
const bytes = (0, import_utils21.randomBytes)(33);
|
|
12337
13186
|
bytes[0] = 3;
|
|
12338
13187
|
bytes[1] = index + 100;
|
|
12339
|
-
return `0x${(0,
|
|
13188
|
+
return `0x${(0, import_utils21.bytesToHex)(bytes)}`;
|
|
12340
13189
|
}
|
|
12341
13190
|
generateMockSignature(data) {
|
|
12342
13191
|
const sig = new Uint8Array(65);
|
|
@@ -12345,7 +13194,7 @@ var MockTrezorAdapter = class extends BaseWalletAdapter {
|
|
|
12345
13194
|
sig[32 + i] = (data[i % data.length] ?? 0) ^ i * 17;
|
|
12346
13195
|
}
|
|
12347
13196
|
sig[64] = 28;
|
|
12348
|
-
return `0x${(0,
|
|
13197
|
+
return `0x${(0, import_utils21.bytesToHex)(sig)}`;
|
|
12349
13198
|
}
|
|
12350
13199
|
delay(ms) {
|
|
12351
13200
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -12359,12 +13208,12 @@ function createMockTrezorAdapter(config) {
|
|
|
12359
13208
|
}
|
|
12360
13209
|
|
|
12361
13210
|
// src/wallet/index.ts
|
|
12362
|
-
var
|
|
13211
|
+
var import_types54 = require("@sip-protocol/types");
|
|
12363
13212
|
|
|
12364
13213
|
// src/proofs/browser.ts
|
|
12365
13214
|
var import_noir_js = require("@noir-lang/noir_js");
|
|
12366
13215
|
var import_bb = require("@aztec/bb.js");
|
|
12367
|
-
var
|
|
13216
|
+
var import_secp256k17 = require("@noble/curves/secp256k1");
|
|
12368
13217
|
|
|
12369
13218
|
// src/proofs/circuits/funding_proof.json
|
|
12370
13219
|
var funding_proof_default = { noir_version: "1.0.0-beta.15+83245db91dcf63420ef4bcbbd85b98f397fee663", hash: "3859649086066977477", abi: { parameters: [{ name: "minimum_required", type: { kind: "integer", sign: "unsigned", width: 64 }, visibility: "public" }, { name: "asset_id", type: { kind: "field" }, visibility: "public" }, { name: "balance", type: { kind: "integer", sign: "unsigned", width: 64 }, visibility: "private" }, { name: "blinding", type: { kind: "field" }, visibility: "private" }], return_type: { abi_type: { kind: "array", length: 32, type: { kind: "integer", sign: "unsigned", width: 8 } }, visibility: "public" }, error_types: { "2900908756532713827": { error_kind: "string", string: "Insufficient balance" }, "15764276373176857197": { error_kind: "string", string: "Stack too deep" }, "15835548349546956319": { error_kind: "string", string: "Field failed to decompose into specified 32 limbs" } } }, bytecode: "H4sIAAAAAAAA/8VdB7wVxfU+cwEFRRGsGJU1KkWl997hAQqKDRVFQFQUePSq8pAO0hS72MAIdkAUImKLXRA0EdAY8R9LooklamL3v+Ob5e7dN/v2fLM7u/P7TYY398w938w335mPp0kElbaKahw5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9aAVlDBYGC4OFwcJgYbAwWEk52TMGC4OFweJetIoyBguDhcHCYGGwMFgYrKI82TMGC4OFweJetDBYvA8W74OFweJedC4LgzD0mScGJwYn74Pz2aBvw1be/gnRz5uH25uPd/sf60/et5/NP91/4gfx6y8f//vO7/AvO78/fPu0//z0sN9+aP/in3euH/9Z/45A57+/tx/s/w8=", file_map: { "17": { source: `use crate::field::field_less_than;
|
|
@@ -13377,7 +14226,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
13377
14226
|
* Derive secp256k1 public key coordinates from a private key
|
|
13378
14227
|
*/
|
|
13379
14228
|
static derivePublicKey(privateKey) {
|
|
13380
|
-
const uncompressedPubKey =
|
|
14229
|
+
const uncompressedPubKey = import_secp256k17.secp256k1.getPublicKey(privateKey, false);
|
|
13381
14230
|
const x = Array.from(uncompressedPubKey.slice(1, 33));
|
|
13382
14231
|
const y = Array.from(uncompressedPubKey.slice(33, 65));
|
|
13383
14232
|
return { x, y };
|
|
@@ -13590,7 +14439,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
13590
14439
|
message: "Proof generated successfully"
|
|
13591
14440
|
});
|
|
13592
14441
|
const commitmentHashBytes = returnValue;
|
|
13593
|
-
const commitmentHashHex =
|
|
14442
|
+
const commitmentHashHex = bytesToHex11(new Uint8Array(commitmentHashBytes));
|
|
13594
14443
|
const publicInputs = [
|
|
13595
14444
|
`0x${params.minimumRequired.toString(16).padStart(16, "0")}`,
|
|
13596
14445
|
`0x${this.assetIdToField(params.assetId)}`,
|
|
@@ -13598,7 +14447,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
13598
14447
|
];
|
|
13599
14448
|
const proof = {
|
|
13600
14449
|
type: "funding",
|
|
13601
|
-
proof: `0x${
|
|
14450
|
+
proof: `0x${bytesToHex11(proofData.proof)}`,
|
|
13602
14451
|
publicInputs
|
|
13603
14452
|
};
|
|
13604
14453
|
return { proof, publicInputs };
|
|
@@ -13692,7 +14541,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
13692
14541
|
];
|
|
13693
14542
|
const proof = {
|
|
13694
14543
|
type: "validity",
|
|
13695
|
-
proof: `0x${
|
|
14544
|
+
proof: `0x${bytesToHex11(proofData.proof)}`,
|
|
13696
14545
|
publicInputs
|
|
13697
14546
|
};
|
|
13698
14547
|
return { proof, publicInputs };
|
|
@@ -13792,7 +14641,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
13792
14641
|
];
|
|
13793
14642
|
const proof = {
|
|
13794
14643
|
type: "fulfillment",
|
|
13795
|
-
proof: `0x${
|
|
14644
|
+
proof: `0x${bytesToHex11(proofData.proof)}`,
|
|
13796
14645
|
publicInputs
|
|
13797
14646
|
};
|
|
13798
14647
|
return { proof, publicInputs };
|
|
@@ -13832,7 +14681,7 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
13832
14681
|
}
|
|
13833
14682
|
try {
|
|
13834
14683
|
const proofHex = proof.proof.startsWith("0x") ? proof.proof.slice(2) : proof.proof;
|
|
13835
|
-
const proofBytes =
|
|
14684
|
+
const proofBytes = hexToBytes9(proofHex);
|
|
13836
14685
|
const isValid = await backend.verifyProof({
|
|
13837
14686
|
proof: proofBytes,
|
|
13838
14687
|
publicInputs: proof.publicInputs.map(
|
|
@@ -13883,14 +14732,14 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
13883
14732
|
}
|
|
13884
14733
|
async computeCommitmentHash(balance, blindingFactor, assetId) {
|
|
13885
14734
|
const blindingField = this.bytesToField(blindingFactor);
|
|
13886
|
-
const { sha256:
|
|
14735
|
+
const { sha256: sha25615 } = await import("@noble/hashes/sha256");
|
|
13887
14736
|
const { bytesToHex: nobleToHex } = await import("@noble/hashes/utils");
|
|
13888
14737
|
const preimage = new Uint8Array([
|
|
13889
14738
|
...this.bigintToBytes(balance, 8),
|
|
13890
14739
|
...blindingFactor.slice(0, 32),
|
|
13891
|
-
...
|
|
14740
|
+
...hexToBytes9(this.assetIdToField(assetId))
|
|
13892
14741
|
]);
|
|
13893
|
-
const hash2 =
|
|
14742
|
+
const hash2 = sha25615(preimage);
|
|
13894
14743
|
const commitmentHash = nobleToHex(hash2);
|
|
13895
14744
|
return { commitmentHash, blindingField };
|
|
13896
14745
|
}
|
|
@@ -13936,49 +14785,49 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
13936
14785
|
return bytes;
|
|
13937
14786
|
}
|
|
13938
14787
|
async computeSenderCommitment(senderAddressField, senderBlindingField) {
|
|
13939
|
-
const { sha256:
|
|
14788
|
+
const { sha256: sha25615 } = await import("@noble/hashes/sha256");
|
|
13940
14789
|
const { bytesToHex: nobleToHex } = await import("@noble/hashes/utils");
|
|
13941
|
-
const addressBytes =
|
|
13942
|
-
const blindingBytes =
|
|
14790
|
+
const addressBytes = hexToBytes9(senderAddressField);
|
|
14791
|
+
const blindingBytes = hexToBytes9(senderBlindingField.padStart(64, "0"));
|
|
13943
14792
|
const preimage = new Uint8Array([...addressBytes, ...blindingBytes]);
|
|
13944
|
-
const hash2 =
|
|
14793
|
+
const hash2 = sha25615(preimage);
|
|
13945
14794
|
const commitmentX = nobleToHex(hash2.slice(0, 16)).padStart(64, "0");
|
|
13946
14795
|
const commitmentY = nobleToHex(hash2.slice(16, 32)).padStart(64, "0");
|
|
13947
14796
|
return { commitmentX, commitmentY };
|
|
13948
14797
|
}
|
|
13949
14798
|
async computeNullifier(senderSecretField, intentHashField, nonceField) {
|
|
13950
|
-
const { sha256:
|
|
14799
|
+
const { sha256: sha25615 } = await import("@noble/hashes/sha256");
|
|
13951
14800
|
const { bytesToHex: nobleToHex } = await import("@noble/hashes/utils");
|
|
13952
|
-
const secretBytes =
|
|
13953
|
-
const intentBytes =
|
|
13954
|
-
const nonceBytes =
|
|
14801
|
+
const secretBytes = hexToBytes9(senderSecretField.padStart(64, "0"));
|
|
14802
|
+
const intentBytes = hexToBytes9(intentHashField);
|
|
14803
|
+
const nonceBytes = hexToBytes9(nonceField.padStart(64, "0"));
|
|
13955
14804
|
const preimage = new Uint8Array([...secretBytes, ...intentBytes, ...nonceBytes]);
|
|
13956
|
-
const hash2 =
|
|
14805
|
+
const hash2 = sha25615(preimage);
|
|
13957
14806
|
return nobleToHex(hash2);
|
|
13958
14807
|
}
|
|
13959
14808
|
async computeOutputCommitment(outputAmount, outputBlinding) {
|
|
13960
|
-
const { sha256:
|
|
14809
|
+
const { sha256: sha25615 } = await import("@noble/hashes/sha256");
|
|
13961
14810
|
const { bytesToHex: nobleToHex } = await import("@noble/hashes/utils");
|
|
13962
14811
|
const amountBytes = this.bigintToBytes(outputAmount, 8);
|
|
13963
14812
|
const blindingBytes = outputBlinding.slice(0, 32);
|
|
13964
14813
|
const preimage = new Uint8Array([...amountBytes, ...blindingBytes]);
|
|
13965
|
-
const hash2 =
|
|
14814
|
+
const hash2 = sha25615(preimage);
|
|
13966
14815
|
const commitmentX = nobleToHex(hash2.slice(0, 16)).padStart(64, "0");
|
|
13967
14816
|
const commitmentY = nobleToHex(hash2.slice(16, 32)).padStart(64, "0");
|
|
13968
14817
|
return { commitmentX, commitmentY };
|
|
13969
14818
|
}
|
|
13970
14819
|
async computeSolverId(solverSecretField) {
|
|
13971
|
-
const { sha256:
|
|
14820
|
+
const { sha256: sha25615 } = await import("@noble/hashes/sha256");
|
|
13972
14821
|
const { bytesToHex: nobleToHex } = await import("@noble/hashes/utils");
|
|
13973
|
-
const secretBytes =
|
|
13974
|
-
const hash2 =
|
|
14822
|
+
const secretBytes = hexToBytes9(solverSecretField.padStart(64, "0"));
|
|
14823
|
+
const hash2 = sha25615(secretBytes);
|
|
13975
14824
|
return nobleToHex(hash2);
|
|
13976
14825
|
}
|
|
13977
14826
|
async computeOracleMessageHash(recipient, amount, txHash, blockNumber) {
|
|
13978
|
-
const { sha256:
|
|
13979
|
-
const recipientBytes =
|
|
14827
|
+
const { sha256: sha25615 } = await import("@noble/hashes/sha256");
|
|
14828
|
+
const recipientBytes = hexToBytes9(this.hexToField(recipient));
|
|
13980
14829
|
const amountBytes = this.bigintToBytes(amount, 8);
|
|
13981
|
-
const txHashBytes =
|
|
14830
|
+
const txHashBytes = hexToBytes9(this.hexToField(txHash));
|
|
13982
14831
|
const blockBytes = this.bigintToBytes(blockNumber, 8);
|
|
13983
14832
|
const preimage = new Uint8Array([
|
|
13984
14833
|
...recipientBytes,
|
|
@@ -13986,11 +14835,11 @@ var BrowserNoirProvider = class _BrowserNoirProvider {
|
|
|
13986
14835
|
...txHashBytes,
|
|
13987
14836
|
...blockBytes
|
|
13988
14837
|
]);
|
|
13989
|
-
const hash2 =
|
|
14838
|
+
const hash2 = sha25615(preimage);
|
|
13990
14839
|
return Array.from(hash2);
|
|
13991
14840
|
}
|
|
13992
14841
|
getPublicKeyCoordinates(privateKey) {
|
|
13993
|
-
const uncompressedPubKey =
|
|
14842
|
+
const uncompressedPubKey = import_secp256k17.secp256k1.getPublicKey(privateKey, false);
|
|
13994
14843
|
const x = Array.from(uncompressedPubKey.slice(1, 33));
|
|
13995
14844
|
const y = Array.from(uncompressedPubKey.slice(33, 65));
|
|
13996
14845
|
return { x, y };
|
|
@@ -14543,10 +15392,13 @@ var ProofWorker = class _ProofWorker {
|
|
|
14543
15392
|
// Annotate the CommonJS export names for ESM import in node:
|
|
14544
15393
|
0 && (module.exports = {
|
|
14545
15394
|
ATTESTATION_VERSION,
|
|
15395
|
+
AptosStealthService,
|
|
14546
15396
|
BaseWalletAdapter,
|
|
14547
15397
|
BrowserNoirProvider,
|
|
14548
15398
|
CHAIN_NUMERIC_IDS,
|
|
15399
|
+
COSMOS_CHAIN_PREFIXES,
|
|
14549
15400
|
ComplianceManager,
|
|
15401
|
+
CosmosStealthService,
|
|
14550
15402
|
CryptoError,
|
|
14551
15403
|
DEFAULT_THRESHOLD,
|
|
14552
15404
|
DEFAULT_TOTAL_ORACLES,
|
|
@@ -14612,18 +15464,22 @@ var ProofWorker = class _ProofWorker {
|
|
|
14612
15464
|
addBlindings,
|
|
14613
15465
|
addCommitments,
|
|
14614
15466
|
addOracle,
|
|
15467
|
+
aptosAddressToAuthKey,
|
|
14615
15468
|
attachProofs,
|
|
14616
15469
|
base58ToHex,
|
|
14617
15470
|
browserBytesToHex,
|
|
14618
15471
|
browserHexToBytes,
|
|
15472
|
+
checkAptosStealthAddress,
|
|
14619
15473
|
checkEd25519StealthAddress,
|
|
14620
15474
|
checkMobileWASMCompatibility,
|
|
14621
15475
|
checkStealthAddress,
|
|
14622
15476
|
commit,
|
|
14623
15477
|
commitZero,
|
|
14624
15478
|
computeAttestationHash,
|
|
15479
|
+
computeTweakedKey,
|
|
14625
15480
|
createCommitment,
|
|
14626
15481
|
createEthereumAdapter,
|
|
15482
|
+
createKeySpendOnlyOutput,
|
|
14627
15483
|
createLedgerAdapter,
|
|
14628
15484
|
createMockEthereumAdapter,
|
|
14629
15485
|
createMockEthereumProvider,
|
|
@@ -14642,6 +15498,7 @@ var ProofWorker = class _ProofWorker {
|
|
|
14642
15498
|
createShieldedPayment,
|
|
14643
15499
|
createSmartRouter,
|
|
14644
15500
|
createSolanaAdapter,
|
|
15501
|
+
createTaprootOutput,
|
|
14645
15502
|
createTrezorAdapter,
|
|
14646
15503
|
createWalletFactory,
|
|
14647
15504
|
createWorkerBlobURL,
|
|
@@ -14650,8 +15507,10 @@ var ProofWorker = class _ProofWorker {
|
|
|
14650
15507
|
createZcashShieldedService,
|
|
14651
15508
|
createZcashSwapService,
|
|
14652
15509
|
decodeStealthMetaAddress,
|
|
15510
|
+
decodeTaprootAddress,
|
|
14653
15511
|
decryptMemo,
|
|
14654
15512
|
decryptWithViewing,
|
|
15513
|
+
deriveAptosStealthPrivateKey,
|
|
14655
15514
|
deriveEd25519StealthPrivateKey,
|
|
14656
15515
|
deriveOracleId,
|
|
14657
15516
|
deriveStealthPrivateKey,
|
|
@@ -14663,6 +15522,7 @@ var ProofWorker = class _ProofWorker {
|
|
|
14663
15522
|
detectMobileBrowser,
|
|
14664
15523
|
detectMobilePlatform,
|
|
14665
15524
|
detectSolanaWallets,
|
|
15525
|
+
ed25519PublicKeyToAptosAddress,
|
|
14666
15526
|
ed25519PublicKeyToNearAddress,
|
|
14667
15527
|
ed25519PublicKeyToSolanaAddress,
|
|
14668
15528
|
encodeStealthMetaAddress,
|
|
@@ -14671,7 +15531,10 @@ var ProofWorker = class _ProofWorker {
|
|
|
14671
15531
|
formatStablecoinAmount,
|
|
14672
15532
|
fromHex,
|
|
14673
15533
|
fromStablecoinUnits,
|
|
15534
|
+
generateAptosStealthAddress,
|
|
14674
15535
|
generateBlinding,
|
|
15536
|
+
generateCosmosStealthAddress,
|
|
15537
|
+
generateCosmosStealthMetaAddress,
|
|
14675
15538
|
generateEd25519StealthAddress,
|
|
14676
15539
|
generateEd25519StealthMetaAddress,
|
|
14677
15540
|
generateIntentId,
|
|
@@ -14704,6 +15567,7 @@ var ProofWorker = class _ProofWorker {
|
|
|
14704
15567
|
getStablecoinsForChain,
|
|
14705
15568
|
getSupportedStablecoins,
|
|
14706
15569
|
getTimeRemaining,
|
|
15570
|
+
getXOnlyPublicKey,
|
|
14707
15571
|
hasEnoughOracles,
|
|
14708
15572
|
hasErrorCode,
|
|
14709
15573
|
hasRequiredProofs,
|
|
@@ -14721,8 +15585,10 @@ var ProofWorker = class _ProofWorker {
|
|
|
14721
15585
|
isStablecoinOnChain,
|
|
14722
15586
|
isTablet,
|
|
14723
15587
|
isValidAmount,
|
|
15588
|
+
isValidAptosAddress,
|
|
14724
15589
|
isValidChainId,
|
|
14725
15590
|
isValidCompressedPublicKey,
|
|
15591
|
+
isValidCosmosAddress,
|
|
14726
15592
|
isValidEd25519PublicKey,
|
|
14727
15593
|
isValidHex,
|
|
14728
15594
|
isValidHexLength,
|
|
@@ -14734,12 +15600,17 @@ var ProofWorker = class _ProofWorker {
|
|
|
14734
15600
|
isValidSlippage,
|
|
14735
15601
|
isValidSolanaAddress,
|
|
14736
15602
|
isValidStealthMetaAddress,
|
|
15603
|
+
isValidTaprootAddress,
|
|
14737
15604
|
nearAddressToEd25519PublicKey,
|
|
14738
15605
|
normalizeAddress,
|
|
14739
15606
|
notConnectedError,
|
|
14740
15607
|
publicKeyToEthAddress,
|
|
14741
15608
|
registerWallet,
|
|
14742
15609
|
removeOracle,
|
|
15610
|
+
schnorrSign,
|
|
15611
|
+
schnorrSignHex,
|
|
15612
|
+
schnorrVerify,
|
|
15613
|
+
schnorrVerifyHex,
|
|
14743
15614
|
secureWipe,
|
|
14744
15615
|
secureWipeAll,
|
|
14745
15616
|
serializeAttestationMessage,
|
|
@@ -14748,6 +15619,7 @@ var ProofWorker = class _ProofWorker {
|
|
|
14748
15619
|
signAttestationMessage,
|
|
14749
15620
|
solanaAddressToEd25519PublicKey,
|
|
14750
15621
|
solanaPublicKeyToHex,
|
|
15622
|
+
stealthKeyToCosmosAddress,
|
|
14751
15623
|
subtractBlindings,
|
|
14752
15624
|
subtractCommitments,
|
|
14753
15625
|
supportsSharedArrayBuffer,
|
|
@@ -14759,6 +15631,7 @@ var ProofWorker = class _ProofWorker {
|
|
|
14759
15631
|
supportsWebHID,
|
|
14760
15632
|
supportsWebUSB,
|
|
14761
15633
|
supportsWebWorkers,
|
|
15634
|
+
taprootAddress,
|
|
14762
15635
|
toHex,
|
|
14763
15636
|
toStablecoinUnits,
|
|
14764
15637
|
trackIntent,
|