stellar-aa-sdk 0.1.0 → 2.0.1
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/README.md +286 -149
- package/dist/SmartWallet.d.ts +69 -9
- package/dist/SmartWallet.d.ts.map +1 -1
- package/dist/SmartWallet.js +82 -23
- package/dist/SmartWallet.js.map +1 -1
- package/dist/WalletFactory.d.ts +2 -2
- package/dist/WalletFactory.d.ts.map +1 -1
- package/dist/WalletFactory.js +6 -3
- package/dist/WalletFactory.js.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,214 +1,351 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Stellar Account Abstraction SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Production-ready Account Abstraction for Stellar** - Build smart wallets that work with the entire Soroban ecosystem.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What is This?
|
|
6
|
+
|
|
7
|
+
A TypeScript SDK for building smart contract wallets on Stellar that:
|
|
8
|
+
- ✅ Work with **ANY** Soroban contract (DEXs, tokens, lending, NFTs, etc.)
|
|
9
|
+
- ✅ Support session keys for delegated access
|
|
10
|
+
- ✅ Enable social recovery with guardians
|
|
11
|
+
- ✅ Follow Stellar's standards (`CustomAccountInterface` with `__check_auth`)
|
|
12
|
+
- ✅ Provide full TypeScript SDK with simple API
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
## Installation
|
|
8
15
|
|
|
9
16
|
```bash
|
|
10
|
-
npm install
|
|
17
|
+
npm install stellar-aa-sdk
|
|
11
18
|
```
|
|
12
19
|
|
|
13
|
-
##
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
### Deploy a Smart Wallet
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { WalletFactory, SmartWallet, StellarSDK } from 'stellar-aa-sdk';
|
|
26
|
+
|
|
27
|
+
const { Keypair, Networks } = StellarSDK;
|
|
28
|
+
|
|
29
|
+
const factory = new WalletFactory({
|
|
30
|
+
wasmHash: 'YOUR_WASM_HASH',
|
|
31
|
+
rpcUrl: 'https://soroban-testnet.stellar.org',
|
|
32
|
+
networkPassphrase: Networks.TESTNET,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const ownerKeypair = Keypair.random();
|
|
36
|
+
const sourceKeypair = Keypair.random(); // Pays fees
|
|
37
|
+
|
|
38
|
+
// Fund source account first (testnet: https://friendbot.stellar.org)
|
|
39
|
+
|
|
40
|
+
const contractId = await factory.createWallet(ownerKeypair, sourceKeypair);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Interact with ANY Soroban Contract
|
|
44
|
+
|
|
45
|
+
Your smart wallet works with **any** Soroban contract using the `__check_auth` pattern:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { Contract, TransactionBuilder, rpc } from '@stellar/stellar-sdk';
|
|
49
|
+
|
|
50
|
+
// Example: Transfer tokens
|
|
51
|
+
const tokenContract = new Contract(tokenContractId);
|
|
52
|
+
const server = new rpc.Server(rpcUrl);
|
|
53
|
+
const sourceAccount = await server.getAccount(sourceKeypair.publicKey());
|
|
54
|
+
|
|
55
|
+
const tx = new TransactionBuilder(sourceAccount, {
|
|
56
|
+
fee: '10000',
|
|
57
|
+
networkPassphrase: Networks.TESTNET,
|
|
58
|
+
})
|
|
59
|
+
.addOperation(
|
|
60
|
+
tokenContract.call('transfer',
|
|
61
|
+
smartWalletAddress, // Smart wallet authorizes this
|
|
62
|
+
recipientAddress,
|
|
63
|
+
amount
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
.setTimeout(30)
|
|
67
|
+
.build();
|
|
68
|
+
|
|
69
|
+
const preparedTx = await server.prepareTransaction(tx);
|
|
70
|
+
preparedTx.sign(ownerKeypair);
|
|
71
|
+
await server.sendTransaction(preparedTx);
|
|
72
|
+
|
|
73
|
+
// When the token contract calls require_auth(smartWalletAddress),
|
|
74
|
+
// Stellar automatically invokes your wallet's __check_auth
|
|
75
|
+
// Your wallet verifies the signature and approves the transfer
|
|
76
|
+
```
|
|
14
77
|
|
|
15
|
-
|
|
78
|
+
## How It Works
|
|
16
79
|
|
|
17
|
-
###
|
|
80
|
+
### The __check_auth Pattern
|
|
18
81
|
|
|
19
|
-
|
|
82
|
+
Instead of forwarding calls (which breaks compatibility), this SDK uses Stellar's `__check_auth`:
|
|
20
83
|
|
|
21
|
-
1.
|
|
22
|
-
2.
|
|
84
|
+
1. You call any contract (DEX, token, etc.)
|
|
85
|
+
2. That contract calls `require_auth(your_smart_wallet)`
|
|
86
|
+
3. Stellar automatically invokes `your_wallet.__check_auth()`
|
|
87
|
+
4. Your wallet verifies the signature
|
|
88
|
+
5. Transaction proceeds if authorized
|
|
23
89
|
|
|
24
|
-
|
|
90
|
+
**Result**: Your smart wallet works with ANY Soroban contract automatically!
|
|
25
91
|
|
|
26
|
-
|
|
92
|
+
## API Reference
|
|
27
93
|
|
|
28
|
-
|
|
94
|
+
### WalletFactory
|
|
29
95
|
|
|
30
96
|
#### Constructor
|
|
31
97
|
|
|
32
|
-
|
|
98
|
+
```typescript
|
|
99
|
+
new WalletFactory(config: FactoryConfig)
|
|
100
|
+
```
|
|
33
101
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- `rpcUrl`: The URL of the Soroban RPC server.
|
|
41
|
-
- `networkPassphrase`: The network passphrase (e.g., `Networks.TESTNET`).
|
|
102
|
+
**Config:**
|
|
103
|
+
- `wasmHash`: WASM hash of the smart-wallet contract
|
|
104
|
+
- **Testnet**: `d6ab7a7ab47085df18aa8c526581d24a792b232f84f04ac3d85d4ee519a70eb0`
|
|
105
|
+
- Deploy your own: See [deployment guide](https://github.com/Payfrom/stellar-aa-sdk)
|
|
106
|
+
- `rpcUrl`: Soroban RPC server URL
|
|
107
|
+
- `networkPassphrase`: Network passphrase (e.g., `Networks.TESTNET`)
|
|
42
108
|
|
|
43
109
|
#### Methods
|
|
44
110
|
|
|
45
|
-
##### `createWallet(
|
|
111
|
+
##### `createWallet(ownerKeypair: Keypair, sourceKeypair: Keypair): Promise<string>`
|
|
46
112
|
|
|
47
|
-
Deploys
|
|
113
|
+
Deploys and initializes a new smart wallet.
|
|
48
114
|
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
115
|
+
- `ownerKeypair`: Keypair that will own the smart wallet
|
|
116
|
+
- `sourceKeypair`: Keypair that pays for deployment (must be funded)
|
|
117
|
+
- Returns: Contract ID of the deployed wallet
|
|
52
118
|
|
|
53
|
-
|
|
119
|
+
### SmartWallet
|
|
120
|
+
|
|
121
|
+
#### Constructor
|
|
54
122
|
|
|
55
123
|
```typescript
|
|
56
|
-
|
|
124
|
+
new SmartWallet(config: WalletConfig)
|
|
125
|
+
```
|
|
57
126
|
|
|
58
|
-
|
|
127
|
+
**Config:**
|
|
128
|
+
- `contractId`: Contract ID of the deployed smart wallet
|
|
129
|
+
- `rpcUrl`: Soroban RPC server URL
|
|
130
|
+
- `networkPassphrase`: Network passphrase
|
|
59
131
|
|
|
60
|
-
|
|
61
|
-
const networkPassphrase = Networks.TESTNET;
|
|
62
|
-
const wasmHash = "8a02111e765f6fc970a95b9af8efc137649a611b2b576a52bfe5c59a0a1a5da0"; // Testnet WASM hash
|
|
63
|
-
|
|
64
|
-
// Helper to fund account via Friendbot (Testnet only)
|
|
65
|
-
async function fundAccount(publicKey: string) {
|
|
66
|
-
const response = await fetch(
|
|
67
|
-
`https://friendbot.stellar.org?addr=${encodeURIComponent(publicKey)}`
|
|
68
|
-
);
|
|
69
|
-
if (!response.ok) throw new Error("Failed to fund account");
|
|
70
|
-
await response.json();
|
|
71
|
-
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
72
|
-
}
|
|
132
|
+
#### Methods
|
|
73
133
|
|
|
74
|
-
|
|
75
|
-
const factory = new WalletFactory({ wasmHash, rpcUrl, networkPassphrase });
|
|
134
|
+
##### Session Management
|
|
76
135
|
|
|
77
|
-
|
|
78
|
-
|
|
136
|
+
```typescript
|
|
137
|
+
createSession(
|
|
138
|
+
sessionKeyAddress: string,
|
|
139
|
+
sessionKeyPubkey: Buffer,
|
|
140
|
+
limit: string,
|
|
141
|
+
durationSeconds: number,
|
|
142
|
+
ownerKeypair: Keypair
|
|
143
|
+
): Promise<GetTransactionResponse>
|
|
144
|
+
```
|
|
79
145
|
|
|
80
|
-
|
|
81
|
-
await fundAccount(sourceKeypair.publicKey());
|
|
146
|
+
Creates a session key with spending limit and expiration.
|
|
82
147
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
148
|
+
```typescript
|
|
149
|
+
revokeSession(
|
|
150
|
+
sessionKeyAddress: string,
|
|
151
|
+
ownerKeypair: Keypair
|
|
152
|
+
): Promise<GetTransactionResponse>
|
|
153
|
+
```
|
|
86
154
|
|
|
87
|
-
|
|
88
|
-
}
|
|
155
|
+
Revokes a session key.
|
|
89
156
|
|
|
90
|
-
|
|
157
|
+
```typescript
|
|
158
|
+
getSession(sessionKeyAddress: string): Promise<Session | null>
|
|
91
159
|
```
|
|
92
160
|
|
|
93
|
-
|
|
161
|
+
Gets session details (read-only).
|
|
94
162
|
|
|
95
|
-
|
|
163
|
+
##### Guardian Management
|
|
96
164
|
|
|
97
|
-
|
|
165
|
+
```typescript
|
|
166
|
+
addGuardians(
|
|
167
|
+
guardianAddresses: string[],
|
|
168
|
+
ownerKeypair: Keypair
|
|
169
|
+
): Promise<GetTransactionResponse>
|
|
170
|
+
```
|
|
98
171
|
|
|
99
|
-
|
|
172
|
+
Adds guardians for social recovery.
|
|
100
173
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
- `networkPassphrase`: The network passphrase.
|
|
174
|
+
```typescript
|
|
175
|
+
getGuardians(): Promise<string[]>
|
|
176
|
+
```
|
|
105
177
|
|
|
106
|
-
|
|
178
|
+
Gets list of guardians (read-only).
|
|
107
179
|
|
|
108
|
-
|
|
180
|
+
```typescript
|
|
181
|
+
recover(
|
|
182
|
+
newOwnerAddress: string,
|
|
183
|
+
newOwnerPubkey: Buffer,
|
|
184
|
+
guardian1Address: string,
|
|
185
|
+
guardian2Address: string,
|
|
186
|
+
guardian1Keypair: Keypair,
|
|
187
|
+
guardian2Keypair: Keypair
|
|
188
|
+
): Promise<GetTransactionResponse>
|
|
189
|
+
```
|
|
109
190
|
|
|
110
|
-
|
|
191
|
+
Recovers wallet with 2-of-N guardian signatures.
|
|
111
192
|
|
|
112
|
-
|
|
113
|
-
Initializes the wallet. This should only be called once after deployment. `WalletFactory.createWallet` handles this automatically.
|
|
193
|
+
##### View Functions
|
|
114
194
|
|
|
115
|
-
|
|
116
|
-
|
|
195
|
+
```typescript
|
|
196
|
+
getOwner(): Promise<string>
|
|
197
|
+
```
|
|
117
198
|
|
|
118
|
-
|
|
119
|
-
Adds new public keys to the list of guardians for recovery.
|
|
199
|
+
Gets current owner address (read-only).
|
|
120
200
|
|
|
121
|
-
|
|
201
|
+
## Complete Example
|
|
122
202
|
|
|
123
|
-
|
|
124
|
-
|
|
203
|
+
```typescript
|
|
204
|
+
import { WalletFactory, SmartWallet, StellarSDK } from 'stellar-aa-sdk';
|
|
125
205
|
|
|
126
|
-
|
|
127
|
-
|
|
206
|
+
const { Keypair, Networks } = StellarSDK;
|
|
207
|
+
|
|
208
|
+
async function example() {
|
|
209
|
+
// Setup
|
|
210
|
+
const rpcUrl = "https://soroban-testnet.stellar.org";
|
|
211
|
+
const networkPassphrase = Networks.TESTNET;
|
|
212
|
+
const wasmHash = "d6ab7a7ab47085df18aa8c526581d24a792b232f84f04ac3d85d4ee519a70eb0";
|
|
213
|
+
|
|
214
|
+
// Deploy wallet
|
|
215
|
+
const factory = new WalletFactory({ wasmHash, rpcUrl, networkPassphrase });
|
|
216
|
+
const ownerKeypair = Keypair.random();
|
|
217
|
+
const sourceKeypair = Keypair.random();
|
|
218
|
+
|
|
219
|
+
// Fund source (testnet)
|
|
220
|
+
await fetch(`https://friendbot.stellar.org?addr=${sourceKeypair.publicKey()}`);
|
|
221
|
+
|
|
222
|
+
const contractId = await factory.createWallet(ownerKeypair, sourceKeypair);
|
|
223
|
+
const wallet = new SmartWallet({ contractId, rpcUrl, networkPassphrase });
|
|
224
|
+
|
|
225
|
+
// Add guardians
|
|
226
|
+
const guardian1 = Keypair.random();
|
|
227
|
+
const guardian2 = Keypair.random();
|
|
228
|
+
await wallet.addGuardians(
|
|
229
|
+
[guardian1.publicKey(), guardian2.publicKey()],
|
|
230
|
+
ownerKeypair
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
// Create session key
|
|
234
|
+
const sessionKeypair = Keypair.random();
|
|
235
|
+
await wallet.createSession(
|
|
236
|
+
sessionKeypair.publicKey(),
|
|
237
|
+
sessionKeypair.rawPublicKey(),
|
|
238
|
+
'100_000_000', // 100 token limit
|
|
239
|
+
86400, // 24 hours
|
|
240
|
+
ownerKeypair
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
// Later: Recover with guardians
|
|
244
|
+
const newOwner = Keypair.random();
|
|
245
|
+
await wallet.recover(
|
|
246
|
+
newOwner.publicKey(),
|
|
247
|
+
newOwner.rawPublicKey(),
|
|
248
|
+
guardian1.publicKey(),
|
|
249
|
+
guardian2.publicKey(),
|
|
250
|
+
guardian1,
|
|
251
|
+
guardian2
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
```
|
|
128
255
|
|
|
129
|
-
|
|
256
|
+
## Universal Compatibility
|
|
130
257
|
|
|
131
|
-
|
|
132
|
-
Recovers the wallet by setting a `newOwnerPublicKey`. This requires two guardians to sign the transaction. The method uses Soroban's authorization framework with `authorizeEntry` to properly sign multi-party auth requirements.
|
|
258
|
+
Your smart wallet works with:
|
|
133
259
|
|
|
134
|
-
|
|
260
|
+
**Tokens:**
|
|
261
|
+
- ✅ Stellar Asset Contracts (USDC, EURC, etc.)
|
|
262
|
+
- ✅ Custom tokens
|
|
263
|
+
- ✅ Wrapped assets
|
|
135
264
|
|
|
136
|
-
|
|
265
|
+
**DeFi:**
|
|
266
|
+
- ✅ DEX protocols (Soroswap, etc.)
|
|
267
|
+
- ✅ Lending/borrowing platforms
|
|
268
|
+
- ✅ Liquidity pools
|
|
269
|
+
- ✅ Yield farming
|
|
137
270
|
|
|
138
|
-
|
|
139
|
-
|
|
271
|
+
**NFTs & Gaming:**
|
|
272
|
+
- ✅ NFT marketplaces
|
|
273
|
+
- ✅ Game asset contracts
|
|
274
|
+
- ✅ Collectibles
|
|
140
275
|
|
|
141
|
-
|
|
142
|
-
|
|
276
|
+
**Infrastructure:**
|
|
277
|
+
- ✅ Payment gateways
|
|
278
|
+
- ✅ Escrow contracts
|
|
279
|
+
- ✅ Multi-sig wallets
|
|
280
|
+
- ✅ DAO governance
|
|
143
281
|
|
|
144
|
-
|
|
145
|
-
Returns the details of a specific session key, or `null` if not found.
|
|
282
|
+
**Any contract using `require_auth()` works automatically!**
|
|
146
283
|
|
|
147
|
-
|
|
284
|
+
## Use Cases
|
|
285
|
+
|
|
286
|
+
### Session-Based dApps
|
|
287
|
+
|
|
288
|
+
Give dApps temporary access without exposing your main key:
|
|
148
289
|
|
|
149
290
|
```typescript
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
async function interactWithWallet(contractId: string, ownerKeypair: StellarSDK.Keypair) {
|
|
159
|
-
const smartWallet = new SmartWallet({ contractId, rpcUrl, networkPassphrase });
|
|
160
|
-
|
|
161
|
-
console.log("\n--- Interacting with Smart Wallet ---");
|
|
162
|
-
|
|
163
|
-
// Get Owner
|
|
164
|
-
const owner = await smartWallet.getOwner();
|
|
165
|
-
console.log("Current Owner:", owner);
|
|
166
|
-
|
|
167
|
-
// Add Guardians
|
|
168
|
-
// NOTE: Guardian accounts must be funded before they can sign recovery transactions
|
|
169
|
-
const guardian1Keypair = StellarSDK.Keypair.random();
|
|
170
|
-
const guardian2Keypair = StellarSDK.Keypair.random();
|
|
171
|
-
|
|
172
|
-
// Fund guardians (required for recovery)
|
|
173
|
-
await fundAccount(guardian1Keypair.publicKey());
|
|
174
|
-
await fundAccount(guardian2Keypair.publicKey());
|
|
175
|
-
|
|
176
|
-
await smartWallet.addGuardians(
|
|
177
|
-
[guardian1Keypair.publicKey(), guardian2Keypair.publicKey()],
|
|
178
|
-
ownerKeypair
|
|
179
|
-
);
|
|
180
|
-
console.log("Guardians added:", await smartWallet.getGuardians());
|
|
181
|
-
|
|
182
|
-
// Create Session
|
|
183
|
-
const sessionKeypair = StellarSDK.Keypair.random();
|
|
184
|
-
await smartWallet.createSession(
|
|
185
|
-
sessionKeypair.publicKey(),
|
|
186
|
-
"5000000", // 5 XLM limit
|
|
187
|
-
3600, // 1 hour duration
|
|
188
|
-
ownerKeypair
|
|
189
|
-
);
|
|
190
|
-
console.log("Session created for:", sessionKeypair.publicKey());
|
|
191
|
-
console.log("Session info:", await smartWallet.getSession(sessionKeypair.publicKey()));
|
|
192
|
-
|
|
193
|
-
// Recover Wallet
|
|
194
|
-
const newOwnerKeypair = StellarSDK.Keypair.random();
|
|
195
|
-
console.log("Initiating recovery with new owner:", newOwnerKeypair.publicKey());
|
|
196
|
-
await smartWallet.recover(
|
|
197
|
-
newOwnerKeypair.publicKey(),
|
|
198
|
-
guardian1Keypair.publicKey(),
|
|
199
|
-
guardian2Keypair.publicKey(),
|
|
200
|
-
guardian1Keypair,
|
|
201
|
-
guardian2Keypair
|
|
202
|
-
);
|
|
203
|
-
console.log("Wallet recovered. New owner is:", await smartWallet.getOwner());
|
|
204
|
-
}
|
|
291
|
+
await wallet.createSession(
|
|
292
|
+
dappKey.publicKey(),
|
|
293
|
+
dappKey.rawPublicKey(),
|
|
294
|
+
'50_000_000', // 50 token limit
|
|
295
|
+
86400 // 1 day
|
|
296
|
+
);
|
|
297
|
+
```
|
|
205
298
|
|
|
206
|
-
|
|
299
|
+
### Social Recovery
|
|
300
|
+
|
|
301
|
+
Set up trusted contacts to recover your wallet:
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
await wallet.addGuardians([friend1, friend2, family], ownerKeypair);
|
|
305
|
+
|
|
306
|
+
// Later, recover with 2 of 3
|
|
307
|
+
await wallet.recover(newOwner, newOwnerPubkey, friend1, friend2, key1, key2);
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### DeFi Trading
|
|
311
|
+
|
|
312
|
+
Interact with any DEX or DeFi protocol:
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
const tx = new TransactionBuilder(sourceAccount, {...})
|
|
316
|
+
.addOperation(
|
|
317
|
+
dexContract.call('swap', smartWalletAddress, tokenA, tokenB, amount)
|
|
318
|
+
)
|
|
319
|
+
.build();
|
|
207
320
|
```
|
|
208
321
|
|
|
209
|
-
##
|
|
322
|
+
## Testing
|
|
210
323
|
|
|
211
|
-
|
|
324
|
+
See [sdk-test/test.ts](https://github.com/Payfrom/stellar-aa-sdk/tree/master/sdk-test) for complete working examples.
|
|
325
|
+
|
|
326
|
+
## Why v2?
|
|
327
|
+
|
|
328
|
+
| Feature | v1 (execute) | v2 (__check_auth) |
|
|
329
|
+
|---------|--------------|-------------------|
|
|
330
|
+
| Ecosystem compatibility | ~5% | **100%** |
|
|
331
|
+
| Works with SAC tokens | ❌ | ✅ |
|
|
332
|
+
| Works with DEXs | ❌ | ✅ |
|
|
333
|
+
| Standards compliant | ❌ | ✅ |
|
|
334
|
+
| Security | Risky | Secure |
|
|
335
|
+
|
|
336
|
+
**v2 implements Stellar's recommended patterns for full ecosystem compatibility.**
|
|
337
|
+
|
|
338
|
+
## Resources
|
|
339
|
+
|
|
340
|
+
- **GitHub**: https://github.com/Payfrom/stellar-aa-sdk
|
|
341
|
+
- **Full Guide**: See [GUIDE.md](https://github.com/Payfrom/stellar-aa-sdk/blob/master/GUIDE.md)
|
|
342
|
+
- **Stellar Docs**: [Smart Wallets](https://developers.stellar.org/docs/build/guides/contract-accounts/smart-wallets)
|
|
343
|
+
- **Discord**: [Stellar Discord](https://discord.gg/stellar) #passkeys channel
|
|
344
|
+
|
|
345
|
+
## License
|
|
346
|
+
|
|
347
|
+
MIT License - see [LICENSE](https://github.com/Payfrom/stellar-aa-sdk/blob/master/LICENSE)
|
|
212
348
|
|
|
213
349
|
---
|
|
214
|
-
|
|
350
|
+
|
|
351
|
+
**Built for the Stellar ecosystem** - Making Account Abstraction accessible to everyone! 🚀
|
package/dist/SmartWallet.d.ts
CHANGED
|
@@ -14,17 +14,77 @@ export declare class SmartWallet {
|
|
|
14
14
|
private toScArgs;
|
|
15
15
|
/** Sign auth entries for multi-signer transactions */
|
|
16
16
|
private signAuthEntries;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Initialize wallet with owner
|
|
19
|
+
* @param ownerPublicKey - The Stellar address of the owner
|
|
20
|
+
* @param ownerRawPublicKey - The raw 32-byte public key for signature verification
|
|
21
|
+
* @param sourceKeypair - Keypair to pay for the transaction
|
|
22
|
+
*/
|
|
23
|
+
initialize(ownerPublicKey: string, ownerRawPublicKey: Buffer, sourceKeypair: StellarSDK.Keypair): Promise<GetTransactionResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* DEPRECATED: The execute() pattern has been removed.
|
|
26
|
+
*
|
|
27
|
+
* With __check_auth, you now interact with contracts directly.
|
|
28
|
+
* The smart wallet's authorization is automatically verified when the target
|
|
29
|
+
* contract calls require_auth() on the smart wallet address.
|
|
30
|
+
*
|
|
31
|
+
* Example:
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // Instead of: wallet.execute(tokenContract, "transfer", [...])
|
|
34
|
+
* // Do: Call the target contract directly with the smart wallet as the authorizing address
|
|
35
|
+
*
|
|
36
|
+
* const tokenContract = new Contract(tokenContractId);
|
|
37
|
+
* const tx = new TransactionBuilder(...)
|
|
38
|
+
* .addOperation(
|
|
39
|
+
* tokenContract.call("transfer",
|
|
40
|
+
* smartWalletAddress, // The smart wallet authorizes this
|
|
41
|
+
* recipientAddress,
|
|
42
|
+
* amount
|
|
43
|
+
* )
|
|
44
|
+
* )
|
|
45
|
+
* .build();
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @deprecated Use direct contract interaction instead
|
|
49
|
+
*/
|
|
50
|
+
execute(_targetContractId: string, _functionName: string, _args: unknown[], _sourceKeypair: StellarSDK.Keypair): Promise<never>;
|
|
21
51
|
/** Add guardians (owner only) */
|
|
22
52
|
addGuardians(guardianAddresses: string[], sourceKeypair: StellarSDK.Keypair): Promise<GetTransactionResponse>;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Create session key (owner only)
|
|
55
|
+
* @param sessionKeyPublicKey - The Stellar address of the session key
|
|
56
|
+
* @param sessionRawPublicKey - The raw 32-byte public key for signature verification
|
|
57
|
+
* @param limit - Spending limit for this session
|
|
58
|
+
* @param durationSeconds - How long the session is valid
|
|
59
|
+
* @param sourceKeypair - Owner's keypair to authorize
|
|
60
|
+
*/
|
|
61
|
+
createSession(sessionKeyPublicKey: string, sessionRawPublicKey: Buffer, limit: string, durationSeconds: number, sourceKeypair: StellarSDK.Keypair): Promise<GetTransactionResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Revoke a session key (owner only)
|
|
64
|
+
* @param sessionKeyPublicKey - The address of the session key to revoke
|
|
65
|
+
* @param sourceKeypair - Owner's keypair to authorize
|
|
66
|
+
*/
|
|
67
|
+
revokeSession(sessionKeyPublicKey: string, sourceKeypair: StellarSDK.Keypair): Promise<GetTransactionResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* DEPRECATED: The executeSession() pattern has been removed.
|
|
70
|
+
*
|
|
71
|
+
* Session keys now work through __check_auth. When you sign a transaction
|
|
72
|
+
* with a session key, the smart wallet automatically verifies it's valid
|
|
73
|
+
* and within spending limits when require_auth() is called.
|
|
74
|
+
*
|
|
75
|
+
* @deprecated Session keys are now verified automatically in __check_auth
|
|
76
|
+
*/
|
|
77
|
+
executeSession(_sessionKeyPublicKey: string, _targetContractId: string, _functionName: string, _args: unknown[], _amount: string, _sourceKeypair: StellarSDK.Keypair): Promise<never>;
|
|
78
|
+
/**
|
|
79
|
+
* Recover wallet with guardians
|
|
80
|
+
* @param newOwnerPublicKey - The new owner's Stellar address
|
|
81
|
+
* @param newOwnerRawPublicKey - The new owner's raw 32-byte public key
|
|
82
|
+
* @param guardian1PublicKey - First guardian's address
|
|
83
|
+
* @param guardian2PublicKey - Second guardian's address
|
|
84
|
+
* @param guardian1Keypair - First guardian's keypair to sign
|
|
85
|
+
* @param guardian2Keypair - Second guardian's keypair to sign
|
|
86
|
+
*/
|
|
87
|
+
recover(newOwnerPublicKey: string, newOwnerRawPublicKey: Buffer, guardian1PublicKey: string, guardian2PublicKey: string, guardian1Keypair: StellarSDK.Keypair, guardian2Keypair: StellarSDK.Keypair): Promise<GetTransactionResponse>;
|
|
28
88
|
getOwner(): Promise<string>;
|
|
29
89
|
getGuardians(): Promise<string[]>;
|
|
30
90
|
getSession(sessionKeyPublicKey: string): Promise<Session | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartWallet.d.ts","sourceRoot":"","sources":["../src/SmartWallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,OAAO,EACP,YAAY,EAGZ,sBAAsB,EAGvB,MAAM,SAAS,CAAC;AAajB;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,iBAAiB,CAAS;gBAEtB,MAAM,EAAE,YAAY;IAUhC,mDAAmD;YACrC,YAAY;IAmB1B,oCA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oBAAoB,EAAE,MAAM,EAC5B,iBAAiB,EAAE,MAAM,EACzB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,OAAO,EAAE,EAChB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,UAAU,CAAC,OAAO,GACjC,OAAO,CAAC,KAAK,CAAC;IAUjB;;;;;;;;OAQG;IACG,OAAO,CACX,iBAAiB,EAAE,MAAM,EACzB,oBAAoB,EAAE,MAAM,EAC5B,kBAAkB,EAAE,MAAM,EAC1B,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,UAAU,CAAC,OAAO,EACpC,gBAAgB,EAAE,UAAU,CAAC,OAAO,GACnC,OAAO,CAAC,sBAAsB,CAAC;IAyD5B,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAS3B,YAAY,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IASjC,UAAU,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CASvE"}
|
package/dist/SmartWallet.js
CHANGED
|
@@ -83,17 +83,46 @@ class SmartWallet {
|
|
|
83
83
|
}));
|
|
84
84
|
}
|
|
85
85
|
/* Owner Operations */
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Initialize wallet with owner
|
|
88
|
+
* @param ownerPublicKey - The Stellar address of the owner
|
|
89
|
+
* @param ownerRawPublicKey - The raw 32-byte public key for signature verification
|
|
90
|
+
* @param sourceKeypair - Keypair to pay for the transaction
|
|
91
|
+
*/
|
|
92
|
+
async initialize(ownerPublicKey, ownerRawPublicKey, sourceKeypair) {
|
|
93
|
+
const pubKeyScVal = nativeToScVal(ownerRawPublicKey, { type: "bytes" });
|
|
94
|
+
return this.callContract(types_1.ContractMethod.Initialize, [new Address(ownerPublicKey).toScVal(), pubKeyScVal], sourceKeypair);
|
|
89
95
|
}
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
/**
|
|
97
|
+
* DEPRECATED: The execute() pattern has been removed.
|
|
98
|
+
*
|
|
99
|
+
* With __check_auth, you now interact with contracts directly.
|
|
100
|
+
* The smart wallet's authorization is automatically verified when the target
|
|
101
|
+
* contract calls require_auth() on the smart wallet address.
|
|
102
|
+
*
|
|
103
|
+
* Example:
|
|
104
|
+
* ```typescript
|
|
105
|
+
* // Instead of: wallet.execute(tokenContract, "transfer", [...])
|
|
106
|
+
* // Do: Call the target contract directly with the smart wallet as the authorizing address
|
|
107
|
+
*
|
|
108
|
+
* const tokenContract = new Contract(tokenContractId);
|
|
109
|
+
* const tx = new TransactionBuilder(...)
|
|
110
|
+
* .addOperation(
|
|
111
|
+
* tokenContract.call("transfer",
|
|
112
|
+
* smartWalletAddress, // The smart wallet authorizes this
|
|
113
|
+
* recipientAddress,
|
|
114
|
+
* amount
|
|
115
|
+
* )
|
|
116
|
+
* )
|
|
117
|
+
* .build();
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @deprecated Use direct contract interaction instead
|
|
121
|
+
*/
|
|
122
|
+
async execute(_targetContractId, _functionName, _args, _sourceKeypair) {
|
|
123
|
+
throw new Error("execute() has been removed. With __check_auth, interact with contracts directly. " +
|
|
124
|
+
"The smart wallet's __check_auth will be called automatically when the target contract " +
|
|
125
|
+
"calls require_auth(). See SDK documentation for examples.");
|
|
97
126
|
}
|
|
98
127
|
/** Add guardians (owner only) */
|
|
99
128
|
async addGuardians(guardianAddresses, sourceKeypair) {
|
|
@@ -101,33 +130,63 @@ class SmartWallet {
|
|
|
101
130
|
return this.callContract(types_1.ContractMethod.AddGuardians, [nativeToScVal(addresses, { type: "vec" })], sourceKeypair);
|
|
102
131
|
}
|
|
103
132
|
/* Session operations */
|
|
104
|
-
/**
|
|
105
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Create session key (owner only)
|
|
135
|
+
* @param sessionKeyPublicKey - The Stellar address of the session key
|
|
136
|
+
* @param sessionRawPublicKey - The raw 32-byte public key for signature verification
|
|
137
|
+
* @param limit - Spending limit for this session
|
|
138
|
+
* @param durationSeconds - How long the session is valid
|
|
139
|
+
* @param sourceKeypair - Owner's keypair to authorize
|
|
140
|
+
*/
|
|
141
|
+
async createSession(sessionKeyPublicKey, sessionRawPublicKey, limit, durationSeconds, sourceKeypair) {
|
|
142
|
+
const pubKeyScVal = nativeToScVal(sessionRawPublicKey, { type: "bytes" });
|
|
106
143
|
return this.callContract(types_1.ContractMethod.CreateSession, [
|
|
107
144
|
new Address(sessionKeyPublicKey).toScVal(),
|
|
145
|
+
pubKeyScVal,
|
|
108
146
|
nativeToScVal(BigInt(limit), { type: "i128" }),
|
|
109
147
|
nativeToScVal(durationSeconds, { type: "u64" }),
|
|
110
148
|
], sourceKeypair);
|
|
111
149
|
}
|
|
112
|
-
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Revoke a session key (owner only)
|
|
152
|
+
* @param sessionKeyPublicKey - The address of the session key to revoke
|
|
153
|
+
* @param sourceKeypair - Owner's keypair to authorize
|
|
154
|
+
*/
|
|
155
|
+
async revokeSession(sessionKeyPublicKey, sourceKeypair) {
|
|
156
|
+
return this.callContract(types_1.ContractMethod.RevokeSession, [new Address(sessionKeyPublicKey).toScVal()], sourceKeypair);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* DEPRECATED: The executeSession() pattern has been removed.
|
|
160
|
+
*
|
|
161
|
+
* Session keys now work through __check_auth. When you sign a transaction
|
|
162
|
+
* with a session key, the smart wallet automatically verifies it's valid
|
|
163
|
+
* and within spending limits when require_auth() is called.
|
|
164
|
+
*
|
|
165
|
+
* @deprecated Session keys are now verified automatically in __check_auth
|
|
166
|
+
*/
|
|
167
|
+
async executeSession(_sessionKeyPublicKey, _targetContractId, _functionName, _args, _amount, _sourceKeypair) {
|
|
168
|
+
throw new Error("executeSession() has been removed. Session keys are now verified automatically " +
|
|
169
|
+
"in __check_auth when you interact with contracts. Create a session key with " +
|
|
170
|
+
"createSession(), then use it to sign transactions directly.");
|
|
121
171
|
}
|
|
122
172
|
/* Recovery (requires 2 guardian signatures) */
|
|
123
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Recover wallet with guardians
|
|
175
|
+
* @param newOwnerPublicKey - The new owner's Stellar address
|
|
176
|
+
* @param newOwnerRawPublicKey - The new owner's raw 32-byte public key
|
|
177
|
+
* @param guardian1PublicKey - First guardian's address
|
|
178
|
+
* @param guardian2PublicKey - Second guardian's address
|
|
179
|
+
* @param guardian1Keypair - First guardian's keypair to sign
|
|
180
|
+
* @param guardian2Keypair - Second guardian's keypair to sign
|
|
181
|
+
*/
|
|
182
|
+
async recover(newOwnerPublicKey, newOwnerRawPublicKey, guardian1PublicKey, guardian2PublicKey, guardian1Keypair, guardian2Keypair) {
|
|
124
183
|
const sourceAccount = await this.server.getAccount(guardian1Keypair.publicKey());
|
|
125
184
|
// Build transaction
|
|
126
185
|
const tx = new TransactionBuilder(sourceAccount, {
|
|
127
186
|
fee: BASE_FEE,
|
|
128
187
|
networkPassphrase: this.networkPassphrase,
|
|
129
188
|
})
|
|
130
|
-
.addOperation(this.contract.call(types_1.ContractMethod.Recover, new Address(newOwnerPublicKey).toScVal(), new Address(guardian1PublicKey).toScVal(), new Address(guardian2PublicKey).toScVal()))
|
|
189
|
+
.addOperation(this.contract.call(types_1.ContractMethod.Recover, new Address(newOwnerPublicKey).toScVal(), nativeToScVal(newOwnerRawPublicKey, { type: "bytes" }), new Address(guardian1PublicKey).toScVal(), new Address(guardian2PublicKey).toScVal()))
|
|
131
190
|
.setTimeout(30)
|
|
132
191
|
.build();
|
|
133
192
|
// Simulate and validate
|
package/dist/SmartWallet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartWallet.js","sourceRoot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tB,sBAAc,CAAC,YAAY,CAC5B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,mBAA2B;QAC1C,OAAO,IAAA,iCAAiB,EACtB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,iBAAiB,EACtB,sBAAc,CAAC,UAAU,EACzB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC,OAAO,EAAW,CACpD,CAAC;IACJ,CAAC;CACF;AA5TD,kCA4TC"}
|
package/dist/WalletFactory.d.ts
CHANGED
|
@@ -12,11 +12,11 @@ export declare class WalletFactory {
|
|
|
12
12
|
constructor(config: FactoryConfig);
|
|
13
13
|
/**
|
|
14
14
|
* Creates a new SmartWallet instance for a user
|
|
15
|
-
* @param
|
|
15
|
+
* @param ownerKeypair - The keypair that will own this wallet (used to derive address and public key)
|
|
16
16
|
* @param sourceKeypair - Keypair to pay for deployment and sign transactions
|
|
17
17
|
* @returns The contract ID of the newly deployed wallet
|
|
18
18
|
*/
|
|
19
|
-
createWallet(
|
|
19
|
+
createWallet(ownerKeypair: StellarSDK.Keypair, sourceKeypair: StellarSDK.Keypair): Promise<string>;
|
|
20
20
|
/**
|
|
21
21
|
* Deploy a new contract instance from the WASM hash
|
|
22
22
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletFactory.d.ts","sourceRoot":"","sources":["../src/WalletFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAGL,aAAa,EACd,MAAM,SAAS,CAAC;AAQjB;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,aAAa;IAcjC;;;;;OAKG;IACG,YAAY,CAChB,
|
|
1
|
+
{"version":3,"file":"WalletFactory.d.ts","sourceRoot":"","sources":["../src/WalletFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAGL,aAAa,EACd,MAAM,SAAS,CAAC;AAQjB;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,aAAa;IAcjC;;;;;OAKG;IACG,YAAY,CAChB,YAAY,EAAE,UAAU,CAAC,OAAO,EAChC,aAAa,EAAE,UAAU,CAAC,OAAO,GAChC,OAAO,CAAC,MAAM,CAAC;IAoBlB;;;OAGG;YACW,cAAc;CA6C7B"}
|
package/dist/WalletFactory.js
CHANGED
|
@@ -57,11 +57,11 @@ class WalletFactory {
|
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Creates a new SmartWallet instance for a user
|
|
60
|
-
* @param
|
|
60
|
+
* @param ownerKeypair - The keypair that will own this wallet (used to derive address and public key)
|
|
61
61
|
* @param sourceKeypair - Keypair to pay for deployment and sign transactions
|
|
62
62
|
* @returns The contract ID of the newly deployed wallet
|
|
63
63
|
*/
|
|
64
|
-
async createWallet(
|
|
64
|
+
async createWallet(ownerKeypair, sourceKeypair) {
|
|
65
65
|
// 1. Deploy new contract instance from WASM hash
|
|
66
66
|
const contractId = await this.deployInstance(sourceKeypair);
|
|
67
67
|
// 2. Initialize the wallet with the owner
|
|
@@ -70,7 +70,10 @@ class WalletFactory {
|
|
|
70
70
|
rpcUrl: this.rpcUrl,
|
|
71
71
|
networkPassphrase: this.networkPassphrase,
|
|
72
72
|
});
|
|
73
|
-
|
|
73
|
+
// Get the raw public key (32 bytes) from the keypair
|
|
74
|
+
const ownerPublicKey = ownerKeypair.publicKey();
|
|
75
|
+
const ownerRawPublicKey = ownerKeypair.rawPublicKey();
|
|
76
|
+
await wallet.initialize(ownerPublicKey, ownerRawPublicKey, sourceKeypair);
|
|
74
77
|
return contractId;
|
|
75
78
|
}
|
|
76
79
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WalletFactory.js","sourceRoot":"","sources":["../src/WalletFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAmD;AACnD,+CAA4C;AAM5C,mDAA0D;AAE1D,MAAM,EACJ,kBAAkB,EAClB,SAAS,GACV,GAAG,UAAU,CAAC;AAEf;;;GAGG;AACH,MAAa,aAAa;IAMxB,YAAY,MAAqB;QAC/B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAElD,wBAAwB;QACxB,MAAM,cAAc,GAAG,UAA0C,CAAC;QAClE,MAAM,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC;QAC/B,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAChB,
|
|
1
|
+
{"version":3,"file":"WalletFactory.js","sourceRoot":"","sources":["../src/WalletFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iEAAmD;AACnD,+CAA4C;AAM5C,mDAA0D;AAE1D,MAAM,EACJ,kBAAkB,EAClB,SAAS,GACV,GAAG,UAAU,CAAC;AAEf;;;GAGG;AACH,MAAa,aAAa;IAMxB,YAAY,MAAqB;QAC/B,IAAI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,aAAa,CAAC,MAAM,CAAC,WAAkB,CAAC,CAAC;YAC5D,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;CACF;AAlGD,sCAkGC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import * as StellarSDK from '@stellar/stellar-sdk';
|
|
|
2
2
|
export type ScVal = any;
|
|
3
3
|
export declare enum ContractMethod {
|
|
4
4
|
Initialize = "initialize",
|
|
5
|
-
Execute = "execute"
|
|
5
|
+
Execute = "execute",// DEPRECATED - kept for compatibility
|
|
6
6
|
CreateSession = "create_session",
|
|
7
|
-
|
|
7
|
+
RevokeSession = "revoke_session",
|
|
8
|
+
ExecuteSession = "execute_session",// DEPRECATED - kept for compatibility
|
|
8
9
|
AddGuardians = "add_guardians",
|
|
9
10
|
Recover = "recover",
|
|
10
11
|
GetOwner = "get_owner",
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAKnD,MAAM,MAAM,KAAK,GAAG,GAAG,CAAC;AAGxB,oBAAY,cAAc;IACxB,UAAU,eAAe;IACzB,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,sBAAsB,CAAC;AAKnD,MAAM,MAAM,KAAK,GAAG,GAAG,CAAC;AAGxB,oBAAY,cAAc;IACxB,UAAU,eAAe;IACzB,OAAO,YAAY,CAAE,sCAAsC;IAC3D,aAAa,mBAAmB;IAChC,aAAa,mBAAmB;IAChC,cAAc,oBAAoB,CAAE,sCAAsC;IAC1E,YAAY,kBAAkB;IAC9B,OAAO,YAAY;IACnB,QAAQ,cAAc;IACtB,YAAY,kB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BAAiB;IAC3B,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,CAAC,EAAE;QACP,MAAM,EAAE,OAAO,CAAC;KACjB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,UAAU;IACzB,mBAAmB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,OAAO,CAAC;IACpE,oBAAoB,EAAE,OAAO,iBAAiB,CAAC;CAChD;AAGD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,gBAAgB,CAAC;IAC9C,GAAG,EAAE,UAAU,CAAC;IAEhB,mBAAmB,EAAE,CAAC,EAAE,EAAE,UAAU,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,KAAK,UAAU,CAAC,WAAW,CAAC;CAC9F;AAGD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,EAAE,OAAO,UAAU,CAAC,OAAO,CAAC;IACnC,aAAa,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC;IACvC,aAAa,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,KAAK,CAAC;CAClE"}
|
package/dist/types.js
CHANGED
|
@@ -7,6 +7,7 @@ var ContractMethod;
|
|
|
7
7
|
ContractMethod["Initialize"] = "initialize";
|
|
8
8
|
ContractMethod["Execute"] = "execute";
|
|
9
9
|
ContractMethod["CreateSession"] = "create_session";
|
|
10
|
+
ContractMethod["RevokeSession"] = "revoke_session";
|
|
10
11
|
ContractMethod["ExecuteSession"] = "execute_session";
|
|
11
12
|
ContractMethod["AddGuardians"] = "add_guardians";
|
|
12
13
|
ContractMethod["Recover"] = "recover";
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAOA,kCAAkC;AAClC,IAAY,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAOA,kCAAkC;AAClC,IAAY,cAWX;AAXD,WAAY,cAAc;IACxB,2CAAyB,CAAA;IACzB,qCAAmB,CAAA;IACnB,kDAAgC,CAAA;IAChC,kDAAgC,CAAA;IAChC,oDAAkC,CAAA;IAClC,gDAA8B,CAAA;IAC9B,qCAAmB,CAAA;IACnB,wCAAsB,CAAA;IACtB,gDAA8B,CAAA;IAC9B,4CAA0B,CAAA;AAC5B,CAAC,EAXW,cAAc,8BAAd,cAAc,QAWzB;AA8CD,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;AACzB,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B"}
|
package/package.json
CHANGED