@getpara/stellar-sdk-v14-integration 2.21.0 → 2.23.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.
@@ -96,10 +96,12 @@ class ParaStellarSigner {
96
96
  }
97
97
  function createParaStellarSigner({
98
98
  para,
99
+ address,
99
100
  networkPassphrase,
100
101
  walletId
101
102
  }) {
102
- return new ParaStellarSigner(para, networkPassphrase, walletId);
103
+ const resolvedId = address ? para.findWalletByAddress(address, { type: ["STELLAR"] }).id : walletId;
104
+ return new ParaStellarSigner(para, networkPassphrase, resolvedId);
103
105
  }
104
106
  // Annotate the CommonJS export names for ESM import in node:
105
107
  0 && (module.exports = {
@@ -19,7 +19,9 @@ var __async = (__this, __arguments, generator) => {
19
19
  });
20
20
  };
21
21
  import { TransactionBuilder, hash } from "@stellar/stellar-sdk";
22
- import { TransactionReviewError } from "@getpara/core-sdk";
22
+ import {
23
+ TransactionReviewError
24
+ } from "@getpara/core-sdk";
23
25
  import { deriveStellarAddress } from "./utils.js";
24
26
  class ParaStellarSigner {
25
27
  constructor(para, networkPassphrase, walletId) {
@@ -73,10 +75,12 @@ class ParaStellarSigner {
73
75
  }
74
76
  function createParaStellarSigner({
75
77
  para,
78
+ address,
76
79
  networkPassphrase,
77
80
  walletId
78
81
  }) {
79
- return new ParaStellarSigner(para, networkPassphrase, walletId);
82
+ const resolvedId = address ? para.findWalletByAddress(address, { type: ["STELLAR"] }).id : walletId;
83
+ return new ParaStellarSigner(para, networkPassphrase, resolvedId);
80
84
  }
81
85
  export {
82
86
  ParaStellarSigner,
@@ -1,9 +1,7 @@
1
1
  import { contract } from '@stellar/stellar-sdk';
2
- import ParaCore from '@getpara/core-sdk';
3
- export interface CreateParaStellarSignerOptions {
4
- para: ParaCore;
2
+ import ParaCore, { type CreateParaSignerBaseOptions } from '@getpara/core-sdk';
3
+ export interface CreateParaStellarSignerOptions extends CreateParaSignerBaseOptions {
5
4
  networkPassphrase?: string;
6
- walletId?: string;
7
5
  }
8
6
  export declare class ParaStellarSigner {
9
7
  private para;
@@ -16,4 +14,4 @@ export declare class ParaStellarSigner {
16
14
  signTransactionXDR(transactionXDR: string, networkPassphrase: string): Promise<string>;
17
15
  signAuthEntry: contract.SignAuthEntry;
18
16
  }
19
- export declare function createParaStellarSigner({ para, networkPassphrase, walletId, }: CreateParaStellarSignerOptions): ParaStellarSigner;
17
+ export declare function createParaStellarSigner({ para, address, networkPassphrase, walletId, }: CreateParaStellarSignerOptions): ParaStellarSigner;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@getpara/stellar-sdk-v14-integration",
3
- "version": "2.21.0",
3
+ "version": "2.23.0",
4
4
  "dependencies": {
5
- "@getpara/core-sdk": "2.21.0",
5
+ "@getpara/core-sdk": "2.23.0",
6
6
  "bs58": "^6.0.0"
7
7
  },
8
8
  "devDependencies": {
@@ -36,5 +36,5 @@
36
36
  "sideEffects": false,
37
37
  "types": "dist/types/index.d.ts",
38
38
  "typings": "dist/types/index.d.ts",
39
- "gitHead": "61f68bb1344dcec458f9016db39f631bb630b8f4"
39
+ "gitHead": "6e7d16e0f5ac1d63ba89f023919dee5c9eddda47"
40
40
  }
package/README.md DELETED
@@ -1,170 +0,0 @@
1
- # @getpara/stellar-sdk-v14-integration
2
-
3
- [![npm version](https://img.shields.io/npm/v/@getpara/stellar-sdk-v14-integration.svg)](https://www.npmjs.com/package/@getpara/stellar-sdk-v14-integration)
4
-
5
- Para signer integration for the Stellar SDK v14. Sign Stellar transactions and Soroban auth entries using Para's MPC wallets.
6
-
7
- ## Installation
8
-
9
- ```bash
10
- npm install @getpara/stellar-sdk-v14-integration @stellar/stellar-sdk
11
- ```
12
-
13
- ## Quick Start (Soroban Client)
14
-
15
- `ParaStellarSigner` implements the Stellar SDK's `contract.Client` signer interface. Pass its methods directly to a Soroban client:
16
-
17
- ```ts
18
- import { ParaStellarSigner } from "@getpara/stellar-sdk-v14-integration";
19
- import { contract, Networks } from "@stellar/stellar-sdk";
20
-
21
- const signer = new ParaStellarSigner(para, Networks.TESTNET);
22
-
23
- const client = new contract.Client({
24
- contractId: "CABC...XYZ",
25
- networkPassphrase: Networks.TESTNET,
26
- rpcUrl: "https://soroban-testnet.stellar.org",
27
- signTransaction: signer.signTransaction,
28
- signAuthEntry: signer.signAuthEntry,
29
- publicKey: signer.address,
30
- });
31
-
32
- const tx = await client.transfer({ from: signer.address, to: dest, amount: 100n });
33
- const { result } = await tx.signAndSend();
34
- ```
35
-
36
- ## Signing a Classic Transaction
37
-
38
- Build a payment with `TransactionBuilder`, then sign the XDR with the signer:
39
-
40
- ```ts
41
- import { ParaStellarSigner } from "@getpara/stellar-sdk-v14-integration";
42
- import {
43
- Horizon,
44
- Networks,
45
- TransactionBuilder,
46
- Operation,
47
- Asset,
48
- } from "@stellar/stellar-sdk";
49
-
50
- const signer = new ParaStellarSigner(para, Networks.TESTNET);
51
-
52
- const server = new Horizon.Server("https://horizon-testnet.stellar.org");
53
- const account = await server.loadAccount(signer.address);
54
-
55
- const tx = new TransactionBuilder(account, {
56
- fee: "100",
57
- networkPassphrase: Networks.TESTNET,
58
- })
59
- .addOperation(
60
- Operation.payment({
61
- destination: "GDEST...ABC",
62
- asset: Asset.native(),
63
- amount: "10",
64
- })
65
- )
66
- .setTimeout(30)
67
- .build();
68
-
69
- const { signedTxXdr } = await signer.signTransaction(tx.toXDR());
70
- await server.submitTransaction(
71
- TransactionBuilder.fromXDR(signedTxXdr, Networks.TESTNET)
72
- );
73
- ```
74
-
75
- ## Factory Function
76
-
77
- `createParaStellarSigner()` is a convenience wrapper that returns a `ParaStellarSigner` instance:
78
-
79
- ```ts
80
- import { createParaStellarSigner } from "@getpara/stellar-sdk-v14-integration";
81
- import { Networks } from "@stellar/stellar-sdk";
82
-
83
- const signer = createParaStellarSigner({
84
- para,
85
- networkPassphrase: Networks.TESTNET,
86
- });
87
-
88
- // signer.address — the Stellar G-address
89
- // signer.signTransaction(xdr, opts?) — sign a transaction XDR
90
- // signer.signAuthEntry(authEntry, opts?) — sign a Soroban auth entry
91
- // signer.signTransactionXDR(xdr, networkPassphrase) — sign and return just the XDR string
92
- // signer.signBytes(bytes) — sign arbitrary bytes
93
- ```
94
-
95
- ## React Hook
96
-
97
- `useStellarSigner()` from `@getpara/react-sdk` wraps `createParaStellarSigner()` in a React Query hook:
98
-
99
- ```tsx
100
- import { useStellarSigner } from "@getpara/react-sdk";
101
- import { Networks } from "@stellar/stellar-sdk";
102
-
103
- function StellarSignButton() {
104
- const { stellarSigner, isLoading } = useStellarSigner({
105
- networkPassphrase: Networks.TESTNET,
106
- });
107
-
108
- const handleSign = async () => {
109
- if (!stellarSigner) return;
110
- const { signedTxXdr } = await stellarSigner.signTransaction(xdr);
111
- console.log("Signed:", signedTxXdr);
112
- };
113
-
114
- if (isLoading) return <p>Loading signer...</p>;
115
-
116
- return <button onClick={handleSign}>Sign Transaction</button>;
117
- }
118
- ```
119
-
120
- ## Utilities
121
-
122
- ### `deriveStellarAddress(solanaBase58Address: string): string`
123
-
124
- Converts a Solana base58 public key to a Stellar G-address. Both use Ed25519, so the underlying key material is identical.
125
-
126
- ```ts
127
- import { deriveStellarAddress } from "@getpara/stellar-sdk-v14-integration";
128
-
129
- const stellarAddress = deriveStellarAddress(solanaPublicKey);
130
- // => "GABC...XYZ"
131
- ```
132
-
133
- ### `createTestTransaction(para, walletId?, networkPassphrase?): Promise<Transaction>`
134
-
135
- Builds a self-payment transaction for testing. Uses sequence number `"0"` — suitable for signature verification, not for broadcasting. For real transactions, load the account from Horizon first.
136
-
137
- ```ts
138
- import { createTestTransaction } from "@getpara/stellar-sdk-v14-integration";
139
-
140
- const tx = await createTestTransaction(para);
141
- ```
142
-
143
- ## Network Configuration
144
-
145
- The `networkPassphrase` parameter controls which Stellar network transactions are built for. Pass it at construction time and optionally override per-call:
146
-
147
- ```ts
148
- // Default to testnet
149
- const signer = new ParaStellarSigner(para, Networks.TESTNET);
150
-
151
- // Override for a specific call
152
- const { signedTxXdr } = await signer.signTransaction(xdr, {
153
- networkPassphrase: Networks.PUBLIC,
154
- });
155
- ```
156
-
157
- Available passphrases from `@stellar/stellar-sdk`:
158
-
159
- - `Networks.PUBLIC` — `"Public Global Stellar Network ; September 2015"`
160
- - `Networks.TESTNET` — `"Test SDF Network ; September 2015"`
161
-
162
- ## Prerequisites
163
-
164
- - A Para API key — get one at the [Developer Portal](https://developer.getpara.com)
165
- - A Para wallet with a SOLANA wallet type (Stellar reuses SOLANA/Ed25519 keys)
166
-
167
- ## Learn More
168
-
169
- - [Para Documentation](https://docs.getpara.com)
170
- - [Stellar SDK v14 Docs](https://stellar.github.io/js-stellar-sdk/)