@stellar/typescript-wallet-sdk 1.4.0 → 1.5.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.
Files changed (45) hide show
  1. package/CHANGELOG.MD +88 -0
  2. package/README.md +51 -0
  3. package/examples/sep24/sep24.ts +4 -9
  4. package/jest.e2e.config.js +9 -0
  5. package/lib/bundle.js +43625 -43200
  6. package/lib/bundle.js.map +1 -1
  7. package/lib/bundle_browser.js +45203 -42345
  8. package/lib/bundle_browser.js.map +1 -1
  9. package/lib/index.d.ts +1 -0
  10. package/lib/walletSdk/Anchor/index.d.ts +1 -1
  11. package/lib/walletSdk/Auth/AuthHeaderSigner.d.ts +61 -0
  12. package/lib/walletSdk/Auth/index.d.ts +2 -2
  13. package/lib/walletSdk/Exceptions/index.d.ts +6 -0
  14. package/lib/walletSdk/Horizon/AccountService.d.ts +1 -1
  15. package/lib/walletSdk/Horizon/Stellar.d.ts +1 -1
  16. package/lib/walletSdk/Horizon/Transaction/TransactionBuilder.d.ts +1 -1
  17. package/lib/walletSdk/Recovery/AccountRecover.d.ts +1 -1
  18. package/lib/walletSdk/Recovery/index.d.ts +2 -2
  19. package/lib/walletSdk/Types/auth.d.ts +17 -0
  20. package/lib/walletSdk/Types/horizon.d.ts +1 -1
  21. package/lib/walletSdk/Types/index.d.ts +1 -1
  22. package/lib/walletSdk/Types/recovery.d.ts +2 -2
  23. package/package.json +6 -1
  24. package/src/index.ts +5 -0
  25. package/src/walletSdk/Anchor/index.ts +1 -1
  26. package/src/walletSdk/Auth/AuthHeaderSigner.ts +162 -0
  27. package/src/walletSdk/Auth/index.ts +48 -2
  28. package/src/walletSdk/Exceptions/index.ts +19 -0
  29. package/src/walletSdk/Horizon/AccountService.ts +1 -1
  30. package/src/walletSdk/Horizon/Stellar.ts +1 -1
  31. package/src/walletSdk/Horizon/Transaction/TransactionBuilder.ts +1 -1
  32. package/src/walletSdk/Recovery/AccountRecover.ts +1 -1
  33. package/src/walletSdk/Recovery/index.ts +2 -2
  34. package/src/walletSdk/Types/auth.ts +19 -0
  35. package/src/walletSdk/Types/horizon.ts +1 -1
  36. package/src/walletSdk/Types/index.ts +1 -1
  37. package/src/walletSdk/Types/recovery.ts +2 -2
  38. package/test/e2e/README.md +11 -0
  39. package/test/e2e/browser.test.ts +52 -0
  40. package/test/integration/README.md +38 -0
  41. package/test/integration/anchorplatform.test.ts +9 -0
  42. package/test/server.test.ts +13 -0
  43. package/test/wallet.test.ts +85 -0
  44. package/webpack.config.js +4 -0
  45. package/test/README.md +0 -18
package/CHANGELOG.MD ADDED
@@ -0,0 +1,88 @@
1
+ # Release notes - Typescript Wallet SDK - 1.5.0
2
+
3
+ # Added
4
+ * AuthHeaderSigner to Authentication Flow
5
+ * End to end tests for testing browser build
6
+ * Beta builds on merges to develop branch
7
+
8
+ # Release notes - Typescript Wallet SDK - 1.4.0
9
+
10
+ ### Added
11
+ * SEP-10 sign challenge transaction helper
12
+ * Anchor platform integration tests
13
+ * Change project structure to monorepo
14
+ * Helper for parsing AnchorTransaction
15
+
16
+ ### Fixed
17
+ * Fix stellar-sdk imports
18
+
19
+ # Release notes - Typescript Wallet SDK - 1.3.1
20
+
21
+ ### Added
22
+ * Upgraded stellar-sdk to 11.1.0
23
+
24
+ # Release notes - Typescript Wallet SDK - 1.3.0
25
+
26
+ ### Added
27
+ * Type aliases
28
+ * Account setup and recovery using SEP-30
29
+ * Customer / SEP-12 code
30
+ * SEP-6 deposit and withdrawal
31
+ * Exchange endpoints
32
+ * Recovery integration tests
33
+ * Watcher and polling for SEP-6
34
+ * AuthToken class
35
+ * Account merge and premade assets
36
+ * SEP-38 info, price, and prices
37
+ * SEP-38 Quote
38
+
39
+ ### Fixed
40
+ * Some small fixes to recovery code
41
+
42
+ # Release notes - Typescript Wallet SDK - 1.2.1
43
+
44
+ ### Fixed
45
+ * Better handle axios errors
46
+
47
+ # Release notes - Typescript Wallet SDK - 1.2.0
48
+
49
+ ### Added
50
+ * Sponosring transactions
51
+ * Account modification functions
52
+ * Default domain signer and default client_domain
53
+ * Path payment and swap
54
+ * Sep24 example code
55
+
56
+ ### Fixed
57
+ * Add build for both node and browser
58
+
59
+ # Release notes - Typescript Wallet SDK - 1.1.3
60
+
61
+ ### Fixed
62
+ * Check if withdraw memo is hash type
63
+
64
+ ### Added
65
+ * Upgrading stellar-sdk veresion for protocol 20
66
+
67
+
68
+ # Release notes - Typescript Wallet SDK - 1.1.2
69
+
70
+ ### Fixed
71
+ * Fix watcher stopping
72
+ * Only emit txn if status changed
73
+
74
+
75
+ # Release notes - Typescript Wallet SDK - 1.1.0
76
+
77
+ ### Added
78
+ * Submitting a transaction
79
+ * Manage non-XLM trustlines
80
+ * Importing and signing arbitrary transactions given an XDR
81
+ * Horizon getInfo and gitHistory functions
82
+ * Helper method for creating a keypair from random bytes
83
+ * Exporting classes
84
+ * Transfer withdrawal method
85
+ * Fee bump transaction
86
+ * Building function to submitWithFeeIncrease
87
+
88
+
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # Stellar Typescript Wallet SDK [![npm version](https://badge.fury.io/js/@stellar%2Ftypescript-wallet-sdk.svg)](https://badge.fury.io/js/@stellar%2Ftypescript-wallet-sdk)
2
+
3
+ Typescript Wallet SDK is a library that allows developers to build wallet
4
+ applications on the Stellar network faster. It utilizes
5
+ [Javascript Stellar SDK](https://github.com/stellar/js-stellar-sdk) to
6
+ communicate with a Stellar Horizon server.
7
+ It offers wide range of functionality to simplify integration with the Stellar
8
+ network, and connect to the anchors easily, utilizing various Stellar protocols
9
+ (SEPs)
10
+
11
+ ## Dependency
12
+
13
+ The library is available via npm. To import `typescript-wallet-sdk` library you
14
+ need to add it as a dependency to your code:
15
+
16
+ yarn:
17
+
18
+ ```shell
19
+ yarn add @stellar/typescript-wallet-sdk
20
+ ```
21
+
22
+ npm:
23
+
24
+ ```shell
25
+ npm install @stellar/typescript-wallet-sdk
26
+ ```
27
+
28
+ ## Introduction
29
+
30
+ Here's a small example creating main wallet class with default configuration
31
+ connected to testnet network:
32
+
33
+ ```typescript
34
+ let wallet = walletSdk.Wallet.TestNet();
35
+ ```
36
+
37
+ It should later be re-used across the code, as it has access to various useful
38
+ children classes. For example, you can authenticate with the `testanchor` as
39
+ simple as:
40
+
41
+ ```typescript
42
+ const authKey = SigningKeypair.fromSecret("my secret key");
43
+ const anchor = wallet.anchor({ homeDomain: "testanchor.stellar.org" });
44
+ const sep10 = await anchor.sep10();
45
+
46
+ const authToken = await sep10.authenticate({ accountKp: authKey });
47
+ ```
48
+
49
+ Read
50
+ [full wallet guide](https://developers.stellar.org/docs/category/build-a-wallet-with-the-wallet-sdk)
51
+ for more info
@@ -9,6 +9,7 @@ import {
9
9
  Types,
10
10
  IssuedAssetId,
11
11
  DefaultSigner,
12
+ Wallet,
12
13
  } from "../../src";
13
14
  import {
14
15
  Memo,
@@ -34,7 +35,7 @@ const clientSecret = process.env.CLIENT_SECRET;
34
35
 
35
36
  // Running example
36
37
 
37
- let wallet;
38
+ let wallet: Wallet;
38
39
  if (runMainnet === "true") {
39
40
  console.log("Warning: you are running this script on the public network.");
40
41
  wallet = walletSdk.Wallet.MainNet();
@@ -123,7 +124,6 @@ export let depositDone = false;
123
124
  export const runDepositWatcher = (anchor: Anchor) => {
124
125
  console.log("\nstarting watcher ...");
125
126
 
126
- const stop: Types.WatcherStopFunction;
127
127
  const onMessage = (m: Types.AnchorTransaction) => {
128
128
  console.log({ m });
129
129
  if (m.status === Types.TransactionStatus.completed) {
@@ -138,7 +138,7 @@ export const runDepositWatcher = (anchor: Anchor) => {
138
138
  };
139
139
 
140
140
  const watcher = anchor.sep24().watcher();
141
- const resp = watcher.watchAllTransactions({
141
+ const { stop } = watcher.watchAllTransactions({
142
142
  authToken: authToken,
143
143
  assetCode: asset.code,
144
144
  onMessage,
@@ -146,8 +146,6 @@ export const runDepositWatcher = (anchor: Anchor) => {
146
146
  timeout: 5000,
147
147
  lang: "en-US",
148
148
  });
149
-
150
- stop = resp.stop;
151
149
  };
152
150
 
153
151
  // Create Withdrawal
@@ -188,7 +186,6 @@ const sendWithdrawalTransaction = async (withdrawalTxn, kp) => {
188
186
  export const runWithdrawWatcher = (anchor, kp) => {
189
187
  console.log("\nstarting watcher ...");
190
188
 
191
- const stop;
192
189
  const onMessage = (m) => {
193
190
  console.log({ m });
194
191
 
@@ -208,7 +205,7 @@ export const runWithdrawWatcher = (anchor, kp) => {
208
205
  };
209
206
 
210
207
  const watcher = anchor.sep24().watcher();
211
- const resp = watcher.watchAllTransactions({
208
+ const { stop } = watcher.watchAllTransactions({
212
209
  authToken: authToken,
213
210
  assetCode: asset.code,
214
211
  onMessage,
@@ -216,8 +213,6 @@ export const runWithdrawWatcher = (anchor, kp) => {
216
213
  timeout: 5000,
217
214
  lang: "en-US",
218
215
  });
219
-
220
- stop = resp.stop;
221
216
  };
222
217
 
223
218
  const walletSigner = DefaultSigner;
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ rootDir: "./",
3
+ preset: "ts-jest",
4
+ transform: {
5
+ "^.+\\.(ts|tsx)?$": "ts-jest",
6
+ "^.+\\.(js|jsx)$": "babel-jest",
7
+ },
8
+ testMatch: ["**/e2e/*.test.ts"],
9
+ };