@lombard.finance/sdk-common 3.4.1 → 4.0.0-canary.0.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Lombard Finance
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1 +1,22 @@
1
1
  # @lombard.finance/sdk-common
2
+
3
+ Shared utilities and types used internally by the [Lombard SDK](https://github.com/lombard-finance/sdk) packages.
4
+
5
+ ## What's included
6
+
7
+ - Environment configuration (`Env`, chain definitions)
8
+ - Provider interfaces and abstractions
9
+ - Bitcoin output script generation utilities
10
+ - Chain service abstractions
11
+
12
+ ## Usage
13
+
14
+ This package is an internal dependency of `@lombard.finance/sdk`, `@lombard.finance/sdk-solana`, `@lombard.finance/sdk-starknet`, and `@lombard.finance/sdk-sui`. You typically do not need to install it directly.
15
+
16
+ ```bash
17
+ npm install @lombard.finance/sdk-common
18
+ ```
19
+
20
+ ## License
21
+
22
+ MIT
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@lombard.finance/sdk-common",
3
- "version": "3.4.1",
3
+ "version": "4.0.0-canary.0.4",
4
+ "description": "Shared utilities and types for the Lombard SDK packages",
4
5
  "exports": {
5
6
  ".": {
6
7
  "types": "./src/index.ts",
@@ -14,7 +15,8 @@
14
15
  "types": "./src/index.ts",
15
16
  "files": [
16
17
  "dist",
17
- "src"
18
+ "src",
19
+ "LICENSE"
18
20
  ],
19
21
  "engines": {
20
22
  "node": ">= 18.0.0"
@@ -27,6 +29,24 @@
27
29
  "format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx}\"",
28
30
  "types": "tsc --noEmit"
29
31
  },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/lombard-finance/sdk.git",
35
+ "directory": "packages/sdk-common"
36
+ },
37
+ "homepage": "https://docs.lombard.finance",
38
+ "bugs": {
39
+ "url": "https://github.com/lombard-finance/sdk/issues"
40
+ },
41
+ "keywords": [
42
+ "lombard",
43
+ "sdk",
44
+ "common",
45
+ "utilities"
46
+ ],
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
30
50
  "peerDependencies": {
31
51
  "@bitcoinerlab/secp256k1": "^1.2.0",
32
52
  "bitcoinjs-lib": "^6.1.5"
@@ -1,3 +1,5 @@
1
+ import type { Env } from '../env';
2
+
1
3
  /**
2
4
  * Solana Chain Service
3
5
  *
@@ -14,18 +16,65 @@ export interface SolanaService {
14
16
  }): Promise<{ signature: string }>;
15
17
 
16
18
  /**
17
- * Unstake LBTC on Solana to receive BTC
19
+ * Redeem BTC.b or LBTC on Solana to receive BTC
18
20
  *
19
- * Burns LBTC on Solana and releases BTC to the provided Bitcoin address.
21
+ * Burns the source token on Solana and sends a GMP message to trigger
22
+ * a BTC payout to the specified Bitcoin address.
20
23
  *
21
- * @param args.amount - Amount of LBTC to unstake in base units (satoshis)
24
+ * @param args.amount - Amount to redeem in base units (satoshis)
22
25
  * @param args.btcAddress - Bitcoin address to receive BTC
23
26
  * @param args.network - Solana network ('mainnet-beta', 'devnet', 'testnet')
24
- * @returns Transaction signature
27
+ * @param args.tokenMint - Source SPL mint: must be the environment’s LBTC or BTC.b mint.
28
+ * @returns `{ signature }` — base58 Solana transaction signature for the initiating burn/GMP transaction (not a Bitcoin payout txid).
25
29
  */
26
- unstake(args: {
30
+ redeemForBtc(args: {
27
31
  amount: string;
28
32
  btcAddress: string;
29
33
  network: string;
30
- }): Promise<{ txHash: string }>;
34
+ env?: Env;
35
+ tokenMint: string;
36
+ }): Promise<{ signature: string }>;
37
+
38
+ /**
39
+ * Redeem tokens via Asset Router's generic `redeem` instruction.
40
+ *
41
+ * Burns the source token (default LBTC) and sends a GMP message through
42
+ * the Mailbox to route the destination token (default BTC.b) to the recipient.
43
+ *
44
+ * @param args.amount - Amount in base units (satoshis)
45
+ * @param args.recipient - Owner wallet (Solana base58); the SDK derives the native_mint ATA for the GMP payload from on-chain Asset Router config
46
+ * @param args.network - Solana network
47
+ * @returns `{ signature }` — base58 Solana transaction signature for the submitted transaction.
48
+ */
49
+ redeem(args: {
50
+ amount: string;
51
+ recipient: string;
52
+ network: string;
53
+ env?: Env;
54
+ tokenMint?: string;
55
+ toLchainId?: string;
56
+ toTokenAddress?: string;
57
+ }): Promise<{ signature: string }>;
58
+
59
+ /**
60
+ * Deposit source token (default BTC.b) to receive destination token (default LBTC)
61
+ * via Asset Router's `deposit` instruction.
62
+ *
63
+ * Burns the source token and sends a GMP message through the Mailbox
64
+ * to mint the destination token to the recipient.
65
+ *
66
+ * @param args.amount - Amount in base units (satoshis)
67
+ * @param args.recipient - Owner wallet (Solana base58); the SDK derives the destination mint ATA for the GMP payload
68
+ * @param args.network - Solana network
69
+ * @returns `{ signature }` — base58 Solana transaction signature for the submitted transaction.
70
+ */
71
+ deposit(args: {
72
+ amount: string;
73
+ recipient: string;
74
+ network: string;
75
+ env?: Env;
76
+ sourceTokenMint?: string;
77
+ toLchainId?: string;
78
+ toTokenAddress?: string;
79
+ }): Promise<{ signature: string }>;
31
80
  }