@buildonspark/spark-sdk 0.0.15 → 0.0.16

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.
Files changed (131) hide show
  1. package/dist/services/wallet-config.d.ts +1 -0
  2. package/dist/services/wallet-config.js +1 -0
  3. package/dist/services/wallet-config.js.map +1 -1
  4. package/dist/spark-sdk.d.ts +1 -1
  5. package/dist/spark-sdk.js +3 -3
  6. package/dist/spark-sdk.js.map +1 -1
  7. package/package.json +4 -3
  8. package/src/examples/example.js +247 -0
  9. package/src/examples/example.ts +207 -0
  10. package/src/graphql/client.ts +282 -0
  11. package/src/graphql/mutations/CompleteCoopExit.ts +19 -0
  12. package/src/graphql/mutations/CompleteLeavesSwap.ts +17 -0
  13. package/src/graphql/mutations/RequestCoopExit.ts +20 -0
  14. package/src/graphql/mutations/RequestLightningReceive.ts +26 -0
  15. package/src/graphql/mutations/RequestLightningSend.ts +17 -0
  16. package/src/graphql/mutations/RequestSwapLeaves.ts +24 -0
  17. package/src/graphql/objects/BitcoinNetwork.ts +22 -0
  18. package/src/graphql/objects/CompleteCoopExitInput.ts +41 -0
  19. package/src/graphql/objects/CompleteCoopExitOutput.ts +45 -0
  20. package/src/graphql/objects/CompleteLeavesSwapInput.ts +45 -0
  21. package/src/graphql/objects/CompleteLeavesSwapOutput.ts +45 -0
  22. package/src/graphql/objects/CompleteSeedReleaseInput.ts +41 -0
  23. package/src/graphql/objects/CompleteSeedReleaseOutput.ts +43 -0
  24. package/src/graphql/objects/Connection.ts +90 -0
  25. package/src/graphql/objects/CoopExitFeeEstimateInput.ts +41 -0
  26. package/src/graphql/objects/CoopExitFeeEstimateOutput.ts +52 -0
  27. package/src/graphql/objects/CoopExitRequest.ts +118 -0
  28. package/src/graphql/objects/CurrencyAmount.ts +74 -0
  29. package/src/graphql/objects/CurrencyUnit.ts +32 -0
  30. package/src/graphql/objects/Entity.ts +202 -0
  31. package/src/graphql/objects/GetChallengeInput.ts +37 -0
  32. package/src/graphql/objects/GetChallengeOutput.ts +43 -0
  33. package/src/graphql/objects/Invoice.ts +83 -0
  34. package/src/graphql/objects/Leaf.ts +59 -0
  35. package/src/graphql/objects/LeavesSwapFeeEstimateInput.ts +37 -0
  36. package/src/graphql/objects/LeavesSwapFeeEstimateOutput.ts +52 -0
  37. package/src/graphql/objects/LeavesSwapRequest.ts +192 -0
  38. package/src/graphql/objects/LightningReceiveFeeEstimateInput.ts +41 -0
  39. package/src/graphql/objects/LightningReceiveFeeEstimateOutput.ts +52 -0
  40. package/src/graphql/objects/LightningReceiveRequest.ts +147 -0
  41. package/src/graphql/objects/LightningReceiveRequestStatus.ts +34 -0
  42. package/src/graphql/objects/LightningSendFeeEstimateInput.ts +37 -0
  43. package/src/graphql/objects/LightningSendFeeEstimateOutput.ts +52 -0
  44. package/src/graphql/objects/LightningSendRequest.ts +134 -0
  45. package/src/graphql/objects/LightningSendRequestStatus.ts +28 -0
  46. package/src/graphql/objects/NotifyReceiverTransferInput.ts +41 -0
  47. package/src/graphql/objects/PageInfo.ts +58 -0
  48. package/src/graphql/objects/Provider.ts +41 -0
  49. package/src/graphql/objects/RequestCoopExitInput.ts +41 -0
  50. package/src/graphql/objects/RequestCoopExitOutput.ts +45 -0
  51. package/src/graphql/objects/RequestLeavesSwapInput.ts +55 -0
  52. package/src/graphql/objects/RequestLeavesSwapOutput.ts +45 -0
  53. package/src/graphql/objects/RequestLightningReceiveInput.ts +58 -0
  54. package/src/graphql/objects/RequestLightningReceiveOutput.ts +45 -0
  55. package/src/graphql/objects/RequestLightningSendInput.ts +41 -0
  56. package/src/graphql/objects/RequestLightningSendOutput.ts +45 -0
  57. package/src/graphql/objects/SparkCoopExitRequestStatus.ts +20 -0
  58. package/src/graphql/objects/SparkLeavesSwapRequestStatus.ts +20 -0
  59. package/src/graphql/objects/SparkTransferToLeavesConnection.ts +79 -0
  60. package/src/graphql/objects/SparkWalletUser.ts +86 -0
  61. package/src/graphql/objects/StartSeedReleaseInput.ts +37 -0
  62. package/src/graphql/objects/SwapLeaf.ts +53 -0
  63. package/src/graphql/objects/Transfer.ts +98 -0
  64. package/src/graphql/objects/UserLeafInput.ts +28 -0
  65. package/src/graphql/objects/VerifyChallengeInput.ts +51 -0
  66. package/src/graphql/objects/VerifyChallengeOutput.ts +43 -0
  67. package/src/graphql/objects/WalletUserIdentityPublicKeyInput.ts +37 -0
  68. package/src/graphql/objects/WalletUserIdentityPublicKeyOutput.ts +43 -0
  69. package/src/graphql/objects/index.ts +67 -0
  70. package/src/graphql/queries/CoopExitFeeEstimate.ts +18 -0
  71. package/src/graphql/queries/CurrentUser.ts +10 -0
  72. package/src/graphql/queries/LightningReceiveFeeEstimate.ts +18 -0
  73. package/src/graphql/queries/LightningSendFeeEstimate.ts +16 -0
  74. package/src/proto/common.ts +431 -0
  75. package/src/proto/google/protobuf/descriptor.ts +6625 -0
  76. package/src/proto/google/protobuf/duration.ts +197 -0
  77. package/src/proto/google/protobuf/empty.ts +83 -0
  78. package/src/proto/google/protobuf/timestamp.ts +226 -0
  79. package/src/proto/mock.ts +151 -0
  80. package/src/proto/spark.ts +12727 -0
  81. package/src/proto/spark_authn.ts +673 -0
  82. package/src/proto/validate/validate.ts +6047 -0
  83. package/src/services/config.ts +71 -0
  84. package/src/services/connection.ts +264 -0
  85. package/src/services/coop-exit.ts +190 -0
  86. package/src/services/deposit.ts +327 -0
  87. package/src/services/lightning.ts +341 -0
  88. package/src/services/lrc20.ts +42 -0
  89. package/src/services/token-transactions.ts +499 -0
  90. package/src/services/transfer.ts +1188 -0
  91. package/src/services/tree-creation.ts +618 -0
  92. package/src/services/wallet-config.ts +141 -0
  93. package/src/signer/signer.ts +531 -0
  94. package/src/spark-sdk.ts +1644 -0
  95. package/src/tests/adaptor-signature.test.ts +64 -0
  96. package/src/tests/bitcoin.test.ts +122 -0
  97. package/src/tests/coop-exit.test.ts +233 -0
  98. package/src/tests/deposit.test.ts +98 -0
  99. package/src/tests/keys.test.ts +82 -0
  100. package/src/tests/lightning.test.ts +307 -0
  101. package/src/tests/secret-sharing.test.ts +63 -0
  102. package/src/tests/swap.test.ts +252 -0
  103. package/src/tests/test-util.ts +92 -0
  104. package/src/tests/tokens.test.ts +47 -0
  105. package/src/tests/transfer.test.ts +371 -0
  106. package/src/tests/tree-creation.test.ts +56 -0
  107. package/src/tests/utils/spark-testing-wallet.ts +37 -0
  108. package/src/tests/utils/test-faucet.ts +257 -0
  109. package/src/types/grpc.ts +8 -0
  110. package/src/types/index.ts +3 -0
  111. package/src/utils/adaptor-signature.ts +189 -0
  112. package/src/utils/bitcoin.ts +138 -0
  113. package/src/utils/crypto.ts +14 -0
  114. package/src/utils/index.ts +12 -0
  115. package/src/utils/keys.ts +92 -0
  116. package/src/utils/mempool.ts +42 -0
  117. package/src/utils/network.ts +70 -0
  118. package/src/utils/proof.ts +17 -0
  119. package/src/utils/response-validation.ts +26 -0
  120. package/src/utils/secret-sharing.ts +263 -0
  121. package/src/utils/signing.ts +96 -0
  122. package/src/utils/token-hashing.ts +163 -0
  123. package/src/utils/token-keyshares.ts +31 -0
  124. package/src/utils/token-transactions.ts +71 -0
  125. package/src/utils/transaction.ts +45 -0
  126. package/src/utils/wasm-wrapper.ts +57 -0
  127. package/src/utils/wasm.ts +154 -0
  128. package/src/wasm/spark_bindings.d.ts +208 -0
  129. package/src/wasm/spark_bindings.js +1161 -0
  130. package/src/wasm/spark_bindings_bg.wasm +0 -0
  131. package/src/wasm/spark_bindings_bg.wasm.d.ts +136 -0
Binary file
@@ -0,0 +1,136 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const uniffi_spark_frost_checksum_func_aggregate_frost: () => number;
5
+ export const uniffi_spark_frost_checksum_func_construct_node_tx: () => number;
6
+ export const uniffi_spark_frost_checksum_func_construct_refund_tx: () => number;
7
+ export const uniffi_spark_frost_checksum_func_construct_split_tx: () => number;
8
+ export const uniffi_spark_frost_checksum_func_create_dummy_tx: () => number;
9
+ export const uniffi_spark_frost_checksum_func_decrypt_ecies: () => number;
10
+ export const uniffi_spark_frost_checksum_func_encrypt_ecies: () => number;
11
+ export const uniffi_spark_frost_checksum_func_frost_nonce: () => number;
12
+ export const uniffi_spark_frost_checksum_func_sign_frost: () => number;
13
+ export const uniffi_spark_frost_checksum_func_validate_signature_share: () => number;
14
+ export const ffi_spark_frost_uniffi_contract_version: () => number;
15
+ export const ffi_spark_frost_rustbuffer_alloc: (a: number, b: bigint, c: number) => void;
16
+ export const ffi_spark_frost_rustbuffer_from_bytes: (a: number, b: number, c: number, d: number) => void;
17
+ export const ffi_spark_frost_rustbuffer_free: (a: bigint, b: bigint, c: number, d: number, e: number) => void;
18
+ export const ffi_spark_frost_rustbuffer_reserve: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: number) => void;
19
+ export const ffi_spark_frost_rust_future_poll_u8: (a: bigint, b: number, c: bigint) => void;
20
+ export const ffi_spark_frost_rust_future_cancel_u8: (a: bigint) => void;
21
+ export const ffi_spark_frost_rust_future_complete_u8: (a: bigint, b: number) => number;
22
+ export const ffi_spark_frost_rust_future_free_u8: (a: bigint) => void;
23
+ export const ffi_spark_frost_rust_future_poll_i8: (a: bigint, b: number, c: bigint) => void;
24
+ export const ffi_spark_frost_rust_future_cancel_i8: (a: bigint) => void;
25
+ export const ffi_spark_frost_rust_future_complete_i8: (a: bigint, b: number) => number;
26
+ export const ffi_spark_frost_rust_future_free_i8: (a: bigint) => void;
27
+ export const ffi_spark_frost_rust_future_poll_u16: (a: bigint, b: number, c: bigint) => void;
28
+ export const ffi_spark_frost_rust_future_cancel_u16: (a: bigint) => void;
29
+ export const ffi_spark_frost_rust_future_complete_u16: (a: bigint, b: number) => number;
30
+ export const ffi_spark_frost_rust_future_free_u16: (a: bigint) => void;
31
+ export const ffi_spark_frost_rust_future_poll_i16: (a: bigint, b: number, c: bigint) => void;
32
+ export const ffi_spark_frost_rust_future_cancel_i16: (a: bigint) => void;
33
+ export const ffi_spark_frost_rust_future_complete_i16: (a: bigint, b: number) => number;
34
+ export const ffi_spark_frost_rust_future_free_i16: (a: bigint) => void;
35
+ export const ffi_spark_frost_rust_future_poll_u32: (a: bigint, b: number, c: bigint) => void;
36
+ export const ffi_spark_frost_rust_future_cancel_u32: (a: bigint) => void;
37
+ export const ffi_spark_frost_rust_future_complete_u32: (a: bigint, b: number) => number;
38
+ export const ffi_spark_frost_rust_future_free_u32: (a: bigint) => void;
39
+ export const ffi_spark_frost_rust_future_poll_i32: (a: bigint, b: number, c: bigint) => void;
40
+ export const ffi_spark_frost_rust_future_cancel_i32: (a: bigint) => void;
41
+ export const ffi_spark_frost_rust_future_complete_i32: (a: bigint, b: number) => number;
42
+ export const ffi_spark_frost_rust_future_free_i32: (a: bigint) => void;
43
+ export const ffi_spark_frost_rust_future_poll_u64: (a: bigint, b: number, c: bigint) => void;
44
+ export const ffi_spark_frost_rust_future_cancel_u64: (a: bigint) => void;
45
+ export const ffi_spark_frost_rust_future_complete_u64: (a: bigint, b: number) => bigint;
46
+ export const ffi_spark_frost_rust_future_free_u64: (a: bigint) => void;
47
+ export const ffi_spark_frost_rust_future_poll_i64: (a: bigint, b: number, c: bigint) => void;
48
+ export const ffi_spark_frost_rust_future_cancel_i64: (a: bigint) => void;
49
+ export const ffi_spark_frost_rust_future_complete_i64: (a: bigint, b: number) => bigint;
50
+ export const ffi_spark_frost_rust_future_free_i64: (a: bigint) => void;
51
+ export const ffi_spark_frost_rust_future_poll_f32: (a: bigint, b: number, c: bigint) => void;
52
+ export const ffi_spark_frost_rust_future_cancel_f32: (a: bigint) => void;
53
+ export const ffi_spark_frost_rust_future_complete_f32: (a: bigint, b: number) => number;
54
+ export const ffi_spark_frost_rust_future_free_f32: (a: bigint) => void;
55
+ export const ffi_spark_frost_rust_future_poll_f64: (a: bigint, b: number, c: bigint) => void;
56
+ export const ffi_spark_frost_rust_future_cancel_f64: (a: bigint) => void;
57
+ export const ffi_spark_frost_rust_future_complete_f64: (a: bigint, b: number) => number;
58
+ export const ffi_spark_frost_rust_future_free_f64: (a: bigint) => void;
59
+ export const ffi_spark_frost_rust_future_poll_pointer: (a: bigint, b: number, c: bigint) => void;
60
+ export const ffi_spark_frost_rust_future_cancel_pointer: (a: bigint) => void;
61
+ export const ffi_spark_frost_rust_future_complete_pointer: (a: bigint, b: number) => number;
62
+ export const ffi_spark_frost_rust_future_free_pointer: (a: bigint) => void;
63
+ export const ffi_spark_frost_rust_future_poll_rust_buffer: (a: bigint, b: number, c: bigint) => void;
64
+ export const ffi_spark_frost_rust_future_cancel_rust_buffer: (a: bigint) => void;
65
+ export const ffi_spark_frost_rust_future_complete_rust_buffer: (a: number, b: bigint, c: number) => void;
66
+ export const ffi_spark_frost_rust_future_free_rust_buffer: (a: bigint) => void;
67
+ export const ffi_spark_frost_rust_future_poll_void: (a: bigint, b: number, c: bigint) => void;
68
+ export const ffi_spark_frost_rust_future_cancel_void: (a: bigint) => void;
69
+ export const ffi_spark_frost_rust_future_complete_void: (a: bigint, b: number) => void;
70
+ export const ffi_spark_frost_rust_future_free_void: (a: bigint) => void;
71
+ export const uniffi_spark_frost_fn_func_aggregate_frost: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: bigint, k: bigint, l: number, m: number, n: bigint, o: bigint, p: number, q: number, r: bigint, s: bigint, t: number, u: number, v: bigint, w: bigint, x: number, y: number, z: bigint, a1: bigint, b1: number, c1: number, d1: bigint, e1: bigint, f1: number, g1: number, h1: bigint, i1: bigint, j1: number, k1: number, l1: number) => void;
72
+ export const uniffi_spark_frost_fn_func_construct_node_tx: (a: number, b: bigint, c: bigint, d: number, e: number, f: number, g: bigint, h: bigint, i: number, j: number, k: number, l: number) => void;
73
+ export const uniffi_spark_frost_fn_func_construct_refund_tx: (a: number, b: bigint, c: bigint, d: number, e: number, f: number, g: bigint, h: bigint, i: number, j: number, k: bigint, l: bigint, m: number, n: number, o: number, p: number) => void;
74
+ export const uniffi_spark_frost_fn_func_construct_split_tx: (a: number, b: bigint, c: bigint, d: number, e: number, f: number, g: bigint, h: bigint, i: number, j: number, k: number, l: number) => void;
75
+ export const uniffi_spark_frost_fn_func_create_dummy_tx: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: number) => void;
76
+ export const uniffi_spark_frost_fn_func_decrypt_ecies: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: number) => void;
77
+ export const uniffi_spark_frost_fn_func_encrypt_ecies: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: number) => void;
78
+ export const uniffi_spark_frost_fn_func_frost_nonce: (a: number, b: bigint, c: bigint, d: number, e: number, f: number) => void;
79
+ export const uniffi_spark_frost_fn_func_sign_frost: (a: number, b: bigint, c: bigint, d: number, e: number, f: bigint, g: bigint, h: number, i: number, j: bigint, k: bigint, l: number, m: number, n: bigint, o: bigint, p: number, q: number, r: bigint, s: bigint, t: number, u: number, v: bigint, w: bigint, x: number, y: number, z: number) => void;
80
+ export const uniffi_spark_frost_fn_func_validate_signature_share: (a: bigint, b: bigint, c: number, d: number, e: bigint, f: bigint, g: number, h: number, i: bigint, j: bigint, k: number, l: number, m: bigint, n: bigint, o: number, p: number, q: bigint, r: bigint, s: number, t: number, u: bigint, v: bigint, w: number, x: number, y: number) => number;
81
+ export const __wbg_signingnonce_free: (a: number, b: number) => void;
82
+ export const __wbg_signingcommitment_free: (a: number, b: number) => void;
83
+ export const signingcommitment_new: (a: number, b: number, c: number, d: number) => number;
84
+ export const __wbg_nonceresult_free: (a: number, b: number) => void;
85
+ export const __wbg_get_nonceresult_nonce: (a: number) => number;
86
+ export const __wbg_set_nonceresult_nonce: (a: number, b: number) => void;
87
+ export const __wbg_get_nonceresult_commitment: (a: number) => number;
88
+ export const __wbg_set_nonceresult_commitment: (a: number, b: number) => void;
89
+ export const __wbg_keypackage_free: (a: number, b: number) => void;
90
+ export const __wbg_get_keypackage_public_key: (a: number) => [number, number];
91
+ export const __wbg_get_keypackage_verifying_key: (a: number) => [number, number];
92
+ export const __wbg_set_keypackage_verifying_key: (a: number, b: number, c: number) => void;
93
+ export const keypackage_new: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
94
+ export const frost_nonce: (a: number) => [number, number, number];
95
+ export const wasm_sign_frost: (a: number, b: number, c: number, d: number, e: number, f: any, g: number, h: number) => [number, number, number, number];
96
+ export const wasm_aggregate_frost: (a: number, b: number, c: any, d: number, e: any, f: number, g: number, h: any, i: number, j: number, k: number, l: number, m: number, n: number) => [number, number, number, number];
97
+ export const __wbg_transactionresult_free: (a: number, b: number) => void;
98
+ export const construct_node_tx: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
99
+ export const construct_refund_tx: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
100
+ export const construct_split_tx: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
101
+ export const __wbg_dummytx_free: (a: number, b: number) => void;
102
+ export const __wbg_get_dummytx_tx: (a: number) => [number, number];
103
+ export const __wbg_set_dummytx_tx: (a: number, b: number, c: number) => void;
104
+ export const __wbg_get_dummytx_txid: (a: number) => [number, number];
105
+ export const __wbg_set_dummytx_txid: (a: number, b: number, c: number) => void;
106
+ export const create_dummy_tx: (a: number, b: number, c: bigint) => [number, number, number];
107
+ export const encrypt_ecies: (a: number, b: number, c: number, d: number) => [number, number, number, number];
108
+ export const decrypt_ecies: (a: number, b: number, c: number, d: number) => [number, number, number, number];
109
+ export const signingnonce_new: (a: number, b: number, c: number, d: number) => number;
110
+ export const __wbg_set_signingnonce_hiding: (a: number, b: number, c: number) => void;
111
+ export const __wbg_set_signingnonce_binding: (a: number, b: number, c: number) => void;
112
+ export const __wbg_set_signingcommitment_hiding: (a: number, b: number, c: number) => void;
113
+ export const __wbg_set_signingcommitment_binding: (a: number, b: number, c: number) => void;
114
+ export const __wbg_set_transactionresult_tx: (a: number, b: number, c: number) => void;
115
+ export const __wbg_set_transactionresult_sighash: (a: number, b: number, c: number) => void;
116
+ export const __wbg_set_keypackage_secret_key: (a: number, b: number, c: number) => void;
117
+ export const __wbg_set_keypackage_public_key: (a: number, b: number, c: number) => void;
118
+ export const __wbg_get_signingnonce_hiding: (a: number) => [number, number];
119
+ export const __wbg_get_signingnonce_binding: (a: number) => [number, number];
120
+ export const __wbg_get_signingcommitment_hiding: (a: number) => [number, number];
121
+ export const __wbg_get_signingcommitment_binding: (a: number) => [number, number];
122
+ export const __wbg_get_transactionresult_tx: (a: number) => [number, number];
123
+ export const __wbg_get_transactionresult_sighash: (a: number) => [number, number];
124
+ export const __wbg_get_keypackage_secret_key: (a: number) => [number, number];
125
+ export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
126
+ export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
127
+ export const rustsecp256k1_v0_10_0_default_illegal_callback_fn: (a: number, b: number) => void;
128
+ export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
129
+ export const __wbindgen_malloc: (a: number, b: number) => number;
130
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
131
+ export const __wbindgen_exn_store: (a: number) => void;
132
+ export const __externref_table_alloc: () => number;
133
+ export const __wbindgen_export_4: WebAssembly.Table;
134
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
135
+ export const __externref_table_dealloc: (a: number) => void;
136
+ export const __wbindgen_start: () => void;