@mysten-incubation/hashi 0.0.1 → 0.1.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/types.d.mts CHANGED
@@ -16,6 +16,10 @@ interface HashiClientOptions<Name = "HashiClient"> {
16
16
  packageId?: string;
17
17
  /** Override the auto-resolved Bitcoin network for address encoding. */
18
18
  bitcoinNetwork?: BitcoinNetwork;
19
+ /** Optional Bitcoin Core JSON-RPC URL for UTXO lookups and confirmation checks. */
20
+ btcRpcUrl?: string;
21
+ /** Override the Sui GraphQL endpoint URL (defaults to `https://fullnode.{network}.sui.io:443/graphql`). */
22
+ graphqlUrl?: string;
19
23
  }
20
24
  /**
21
25
  * Frozen snapshot of every governance-controlled protocol parameter, returned
@@ -133,5 +137,72 @@ interface WithdrawalHistoryItem {
133
137
  /** Bitcoin txid from the `WithdrawalTransaction`, in display byte order. `null` until the committee commits. */
134
138
  readonly btcTxid: string | null;
135
139
  }
140
+ interface HbtcBalance {
141
+ /** Total hBTC balance in satoshis. */
142
+ readonly totalBalance: bigint;
143
+ /** Number of coin objects held. */
144
+ readonly coinObjectCount: number;
145
+ }
146
+ type DepositStatus = "pending" | "confirmed" | "expired" | "unknown";
147
+ interface DepositInfo {
148
+ /** Unique request ID on-chain. */
149
+ readonly requestId: string;
150
+ /** Deposit amount in satoshis. */
151
+ readonly amountSats: bigint;
152
+ /** Recipient Sui address (derivation path). */
153
+ readonly recipient: string | null;
154
+ /** Bitcoin transaction ID (display byte order). */
155
+ readonly btcTxid: string;
156
+ /** Bitcoin output index. */
157
+ readonly btcVout: number;
158
+ /** Request timestamp (ms since epoch). */
159
+ readonly timestampMs: bigint;
160
+ /** Current deposit status. */
161
+ readonly status: DepositStatus;
162
+ /** Sui transaction digest that created this request. */
163
+ readonly suiTxDigest: string;
164
+ }
165
+ interface WithdrawalInfo {
166
+ /** Unique request ID on-chain. */
167
+ readonly requestId: string;
168
+ /** Withdrawal amount in satoshis. */
169
+ readonly btcAmountSats: bigint;
170
+ /** Raw witness program bytes of the destination Bitcoin address. */
171
+ readonly bitcoinAddress: Uint8Array;
172
+ /** Sui address of the requester. */
173
+ readonly sender: string;
174
+ /** Request timestamp (ms since epoch). */
175
+ readonly timestampMs: bigint;
176
+ /** Current withdrawal status. */
177
+ readonly status: WithdrawalStatus | "cancelled";
178
+ /** Sui transaction digest that created this request. */
179
+ readonly suiTxDigest: string;
180
+ /** Bitcoin txid from the `WithdrawalTransaction`, in display byte order. `null` until the committee commits. */
181
+ readonly btcTxid: string | null;
182
+ }
183
+ interface DepositFees {
184
+ /** Estimated gas cost in MIST. */
185
+ readonly gasEstimateMist: bigint;
186
+ }
187
+ interface WithdrawalFees {
188
+ /** Worst-case BTC network fee in satoshis. */
189
+ readonly worstCaseNetworkFeeSats: bigint;
190
+ /** Minimum withdrawal amount in satoshis. */
191
+ readonly withdrawalMinimumSats: bigint;
192
+ /** Estimated gas cost in MIST (`0n` if `sender` was not provided). */
193
+ readonly gasEstimateMist: bigint;
194
+ }
195
+ interface WaitOptions {
196
+ /** Polling interval in milliseconds (default: 15_000). */
197
+ readonly intervalMs?: number;
198
+ /** Abort signal to cancel polling. */
199
+ readonly signal?: AbortSignal;
200
+ }
201
+ interface UtxoLookupResult {
202
+ /** Output index. */
203
+ readonly vout: number;
204
+ /** Amount in satoshis. */
205
+ readonly amountSats: bigint;
206
+ }
136
207
  //#endregion
137
- export { BitcoinNetwork, CancelWithdrawalParams, DepositHistoryItem, DepositParams, GovernanceConfig, HashiClientOptions, NetworkConfig, SuiNetwork, TransactionHistoryItem, UtxoId, UtxoOutput, UtxoUsageResult, WithdrawalHistoryItem, WithdrawalParams, WithdrawalStatus };
208
+ export { BitcoinNetwork, CancelWithdrawalParams, DepositFees, DepositHistoryItem, DepositInfo, DepositParams, DepositStatus, GovernanceConfig, HashiClientOptions, HbtcBalance, NetworkConfig, SuiNetwork, TransactionHistoryItem, UtxoId, UtxoLookupResult, UtxoOutput, UtxoUsageResult, WaitOptions, WithdrawalFees, WithdrawalHistoryItem, WithdrawalInfo, WithdrawalParams, WithdrawalStatus };
package/dist/util.mjs CHANGED
@@ -29,7 +29,7 @@ function assertHex32(value, fieldName) {
29
29
  function reverseTxidBytes(txid) {
30
30
  assertHex32(txid, "txid");
31
31
  const hex = txid.slice(2);
32
- let reversed = "0x";
32
+ let reversed = "";
33
33
  for (let i = hex.length - 2; i >= 0; i -= 2) reversed += hex.slice(i, i + 2);
34
34
  return reversed;
35
35
  }
package/package.json CHANGED
@@ -1,64 +1,65 @@
1
1
  {
2
- "name": "@mysten-incubation/hashi",
3
- "version": "0.0.1",
4
- "description": "TypeScript SDK for the Hashi Sui Move smart contracts",
5
- "license": "Apache-2.0",
6
- "author": "Mysten Labs <build@mystenlabs.com>",
7
- "type": "module",
8
- "main": "./dist/index.mjs",
9
- "types": "./dist/index.d.mts",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.mts",
13
- "import": "./dist/index.mjs"
14
- }
15
- },
16
- "sideEffects": false,
17
- "files": [
18
- "CHANGELOG.md",
19
- "LICENSE",
20
- "dist"
21
- ],
22
- "repository": {
23
- "type": "git",
24
- "url": "git+https://github.com/MystenLabs/hashi-ts-sdk.git"
25
- },
26
- "bugs": {
27
- "url": "https://github.com/MystenLabs/hashi-ts-sdk/issues/new"
28
- },
29
- "homepage": "https://github.com/MystenLabs/hashi-ts-sdk#readme",
30
- "publishConfig": {
31
- "access": "public"
32
- },
33
- "keywords": [
34
- "sui",
35
- "hashi",
36
- "bitcoin",
37
- "btc",
38
- "sdk",
39
- "mysten"
40
- ],
41
- "scripts": {
42
- "build": "rm -rf dist && tsc --noEmit && tsdown",
43
- "test": "vitest --project=unit",
44
- "test:integration": "vitest run --project=integration",
45
- "coverage": "vitest run --project=unit --coverage",
46
- "codegen": "sui-ts-codegen generate",
47
- "format": "prettier --write \"**/*.{ts,json,md}\""
48
- },
49
- "peerDependencies": {
50
- "@mysten/sui": "^2.14.1"
51
- },
52
- "devDependencies": {
53
- "@mysten/codegen": "^0.8.3",
54
- "@mysten/sui": "^2.14.1",
55
- "@types/node": "^25.6.0",
56
- "@vitest/coverage-v8": "^4.1.5",
57
- "vitest": "^4.1.5"
58
- },
59
- "dependencies": {
60
- "@noble/curves": "^2.0.1",
61
- "@noble/hashes": "^2.0.1",
62
- "@scure/base": "^2.0.0"
2
+ "name": "@mysten-incubation/hashi",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript SDK for the Hashi Sui Move smart contracts",
5
+ "license": "Apache-2.0",
6
+ "author": "Mysten Labs <build@mystenlabs.com>",
7
+ "type": "module",
8
+ "main": "./dist/index.mjs",
9
+ "types": "./dist/index.d.mts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.mts",
13
+ "import": "./dist/index.mjs"
63
14
  }
64
- }
15
+ },
16
+ "sideEffects": false,
17
+ "files": [
18
+ "CHANGELOG.md",
19
+ "LICENSE",
20
+ "README.md",
21
+ "dist"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/MystenLabs/hashi-ts-sdk.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/MystenLabs/hashi-ts-sdk/issues/new"
29
+ },
30
+ "homepage": "https://github.com/MystenLabs/hashi-ts-sdk#readme",
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "keywords": [
35
+ "sui",
36
+ "hashi",
37
+ "bitcoin",
38
+ "btc",
39
+ "sdk",
40
+ "mysten"
41
+ ],
42
+ "peerDependencies": {
43
+ "@mysten/sui": "^2.14.1"
44
+ },
45
+ "devDependencies": {
46
+ "@mysten/codegen": "^0.8.3",
47
+ "@mysten/sui": "^2.14.1",
48
+ "@types/node": "^25.6.0",
49
+ "@vitest/coverage-v8": "^4.1.5",
50
+ "vitest": "^4.1.5"
51
+ },
52
+ "dependencies": {
53
+ "@noble/curves": "^2.0.1",
54
+ "@noble/hashes": "^2.0.1",
55
+ "@scure/base": "^2.0.0"
56
+ },
57
+ "scripts": {
58
+ "build": "rm -rf dist && tsc --noEmit && tsdown",
59
+ "test": "vitest --project=unit",
60
+ "test:integration": "vitest run --project=integration",
61
+ "coverage": "vitest run --project=unit --coverage",
62
+ "codegen": "sui-ts-codegen generate",
63
+ "format": "prettier --write \"**/*.{ts,json,md}\""
64
+ }
65
+ }