@stellar/typescript-wallet-sdk 1.2.0 → 1.3.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/.eslintrc.js +76 -0
- package/.github/workflows/integrationTest.yml +19 -0
- package/.github/workflows/runTests.yml +14 -0
- package/.husky/pre-commit +1 -0
- package/README.md +19 -12
- package/examples/sep24/.env.example +4 -0
- package/examples/sep24/README.md +17 -0
- package/examples/sep24/sep24.ts +69 -14
- package/examples/tsconfig.json +10 -0
- package/jest.config.js +1 -0
- package/jest.integration.config.js +9 -0
- package/lib/bundle.js +6929 -2377
- package/lib/bundle.js.map +1 -1
- package/lib/bundle_browser.js +6915 -2410
- package/lib/bundle_browser.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/walletSdk/Anchor/Sep24.d.ts +65 -22
- package/lib/walletSdk/Anchor/Sep38.d.ts +56 -0
- package/lib/walletSdk/Anchor/Sep6.d.ts +127 -0
- package/lib/walletSdk/Anchor/index.d.ts +91 -1
- package/lib/walletSdk/Asset/index.d.ts +11 -1
- package/lib/walletSdk/Auth/WalletSigner.d.ts +41 -1
- package/lib/walletSdk/Auth/index.d.ts +21 -0
- package/lib/walletSdk/Customer/index.d.ts +70 -0
- package/lib/walletSdk/Exceptions/index.d.ts +45 -2
- package/lib/walletSdk/Horizon/AccountService.d.ts +30 -20
- package/lib/walletSdk/Horizon/Stellar.d.ts +79 -2
- package/lib/walletSdk/Horizon/Transaction/CommonTransactionBuilder.d.ts +57 -0
- package/lib/walletSdk/Horizon/Transaction/SponsoringBuilder.d.ts +38 -0
- package/lib/walletSdk/Horizon/Transaction/TransactionBuilder.d.ts +112 -11
- package/lib/walletSdk/Horizon/index.d.ts +3 -1
- package/lib/walletSdk/Recovery/AccountRecover.d.ts +58 -0
- package/lib/walletSdk/Recovery/index.d.ts +69 -7
- package/lib/walletSdk/Types/anchor.d.ts +17 -2
- package/lib/walletSdk/Types/auth.d.ts +14 -1
- package/lib/walletSdk/Types/horizon.d.ts +17 -6
- package/lib/walletSdk/Types/index.d.ts +15 -3
- package/lib/walletSdk/Types/recovery.d.ts +128 -0
- package/lib/walletSdk/Types/sep12.d.ts +57 -0
- package/lib/walletSdk/Types/sep38.d.ts +93 -0
- package/lib/walletSdk/Types/sep6.d.ts +160 -0
- package/lib/walletSdk/Types/watcher.d.ts +7 -2
- package/lib/walletSdk/Utils/extractAxiosErrorData.d.ts +2 -0
- package/lib/walletSdk/Utils/index.d.ts +1 -0
- package/lib/walletSdk/Utils/toml.d.ts +2 -2
- package/lib/walletSdk/Watcher/getTransactions.d.ts +8 -0
- package/lib/walletSdk/Watcher/index.d.ts +41 -4
- package/lib/walletSdk/index.d.ts +43 -5
- package/package.json +17 -4
- package/src/index.ts +2 -0
- package/src/walletSdk/Anchor/Sep24.ts +93 -86
- package/src/walletSdk/Anchor/Sep38.ts +180 -0
- package/src/walletSdk/Anchor/Sep6.ts +291 -0
- package/src/walletSdk/Anchor/index.ts +138 -5
- package/src/walletSdk/Asset/index.ts +21 -4
- package/src/walletSdk/Auth/WalletSigner.ts +23 -5
- package/src/walletSdk/Auth/index.ts +24 -5
- package/src/walletSdk/Customer/index.ts +174 -0
- package/src/walletSdk/Exceptions/index.ts +115 -4
- package/src/walletSdk/Horizon/AccountService.ts +33 -21
- package/src/walletSdk/Horizon/Stellar.ts +89 -5
- package/src/walletSdk/Horizon/Transaction/CommonTransactionBuilder.ts +43 -4
- package/src/walletSdk/Horizon/Transaction/SponsoringBuilder.ts +30 -7
- package/src/walletSdk/Horizon/Transaction/TransactionBuilder.ts +88 -15
- package/src/walletSdk/Horizon/index.ts +2 -1
- package/src/walletSdk/Recovery/AccountRecover.ts +255 -0
- package/src/walletSdk/Recovery/index.ts +314 -13
- package/src/walletSdk/Types/anchor.ts +23 -2
- package/src/walletSdk/Types/auth.ts +36 -2
- package/src/walletSdk/Types/horizon.ts +7 -5
- package/src/walletSdk/Types/index.ts +17 -4
- package/src/walletSdk/Types/recovery.ts +152 -0
- package/src/walletSdk/Types/sep12.ts +61 -0
- package/src/walletSdk/Types/sep38.ts +106 -0
- package/src/walletSdk/Types/sep6.ts +168 -0
- package/src/walletSdk/Types/watcher.ts +8 -2
- package/src/walletSdk/Utils/camelToSnakeCase.ts +1 -0
- package/src/walletSdk/Utils/extractAxiosErrorData.ts +28 -0
- package/src/walletSdk/Utils/index.ts +1 -0
- package/src/walletSdk/Utils/toml.ts +2 -2
- package/src/walletSdk/Watcher/getTransactions.ts +65 -0
- package/src/walletSdk/Watcher/index.ts +70 -9
- package/src/walletSdk/index.ts +45 -8
- package/test/README.md +18 -0
- package/test/accountService.test.ts +21 -3
- package/test/customer.test.ts +82 -0
- package/test/docker/docker-compose.yml +97 -0
- package/test/integration.test.ts +166 -0
- package/test/recovery.test.ts +107 -0
- package/test/sep38.test.ts +71 -0
- package/test/sep6.test.ts +240 -0
- package/test/stellar.test.ts +57 -12
- package/test/transaction.test.ts +8 -10
- package/test/tsconfig.json +10 -0
- package/test/utils/index.ts +12 -0
- package/test/wallet.test.ts +60 -21
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
ignorePatterns: ["lib/", "node_modules/", "docs/"],
|
|
3
|
+
parser: "@typescript-eslint/parser",
|
|
4
|
+
parserOptions: {
|
|
5
|
+
project: ["tsconfig.json", "examples/tsconfig.json", "test/tsconfig.json"],
|
|
6
|
+
sourceType: "module",
|
|
7
|
+
},
|
|
8
|
+
plugins: ["@typescript-eslint", "jsdoc"],
|
|
9
|
+
extends: [
|
|
10
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
11
|
+
"plugin:@typescript-eslint/recommended",
|
|
12
|
+
"prettier",
|
|
13
|
+
],
|
|
14
|
+
rules: {
|
|
15
|
+
// Off
|
|
16
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
17
|
+
"@typescript-eslint/no-floating-promises": "off",
|
|
18
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
19
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
20
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
21
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
22
|
+
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
23
|
+
"@typescript-eslint/restrict-template-expressions": "off",
|
|
24
|
+
"@typescript-eslint/no-inferrable-types": "off",
|
|
25
|
+
"@typescript-eslint/no-misused-promises": "off",
|
|
26
|
+
"@typescript-eslint/no-base-to-string": "off",
|
|
27
|
+
|
|
28
|
+
// Warn
|
|
29
|
+
"jsdoc/check-param-names": "warn",
|
|
30
|
+
"jsdoc/require-returns": "warn",
|
|
31
|
+
"jsdoc/require-returns-description": "warn",
|
|
32
|
+
"jsdoc/require-returns-type": "warn",
|
|
33
|
+
"jsdoc/require-param": "warn",
|
|
34
|
+
"jsdoc/check-types": "warn",
|
|
35
|
+
"jsdoc/require-param-description": "warn",
|
|
36
|
+
"jsdoc/require-param-name": "warn",
|
|
37
|
+
"jsdoc/require-param-type": "warn",
|
|
38
|
+
"jsdoc/require-property": "warn",
|
|
39
|
+
"jsdoc/require-property-description": "warn",
|
|
40
|
+
"jsdoc/require-property-name": "warn",
|
|
41
|
+
"jsdoc/require-property-type": "warn",
|
|
42
|
+
"jsdoc/check-property-names": "warn",
|
|
43
|
+
"jsdoc/empty-tags": "warn",
|
|
44
|
+
|
|
45
|
+
// Error
|
|
46
|
+
"@typescript-eslint/no-shadow": "error",
|
|
47
|
+
"@typescript-eslint/no-unused-expressions": "error",
|
|
48
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
49
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
50
|
+
"@typescript-eslint/prefer-function-type": "error",
|
|
51
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
52
|
+
"@typescript-eslint/triple-slash-reference": [
|
|
53
|
+
"error",
|
|
54
|
+
{
|
|
55
|
+
path: "always",
|
|
56
|
+
types: "prefer-import",
|
|
57
|
+
lib: "always",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
61
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
62
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
63
|
+
"@typescript-eslint/no-empty-interface": "error",
|
|
64
|
+
"jsdoc/check-alignment": "error",
|
|
65
|
+
"jsdoc/check-indentation": "error",
|
|
66
|
+
},
|
|
67
|
+
overrides: [
|
|
68
|
+
{
|
|
69
|
+
files: ["test/**", "examples/**"],
|
|
70
|
+
rules: {
|
|
71
|
+
"@typescript-eslint/no-shadow": "off",
|
|
72
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Recovery Signer Integration Test
|
|
2
|
+
on: [pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
test-ci:
|
|
5
|
+
name: integration test
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
steps:
|
|
8
|
+
- uses: actions/checkout@v2
|
|
9
|
+
- name: Start docker
|
|
10
|
+
run: docker-compose -f test/docker/docker-compose.yml up -d
|
|
11
|
+
- uses: actions/setup-node@v2
|
|
12
|
+
with:
|
|
13
|
+
node-version: 18
|
|
14
|
+
- run: yarn install
|
|
15
|
+
- run: yarn build
|
|
16
|
+
- run: yarn test:integration:ci
|
|
17
|
+
- name: Print Docker Logs
|
|
18
|
+
if: always() # This ensures that the logs are printed even if the tests fail
|
|
19
|
+
run: docker-compose -f test/docker/docker-compose.yml logs
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
name: Run Tests
|
|
2
|
+
on: [pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
test-ci:
|
|
5
|
+
name: test
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
steps:
|
|
8
|
+
- uses: actions/checkout@v2
|
|
9
|
+
- uses: actions/setup-node@v2
|
|
10
|
+
with:
|
|
11
|
+
node-version: 18
|
|
12
|
+
- run: yarn install
|
|
13
|
+
- run: yarn build
|
|
14
|
+
- run: yarn test:ci
|
package/.husky/pre-commit
CHANGED
package/README.md
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
# Stellar Typescript Wallet SDK [](https://badge.fury.io/js/@stellar%2Ftypescript-wallet-sdk)
|
|
1
|
+
# Stellar Typescript Wallet SDK [](https://badge.fury.io/js/@stellar%2Ftypescript-wallet-sdk)
|
|
2
2
|
|
|
3
|
-
Typescript Wallet SDK is a library that allows developers to build wallet
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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)
|
|
7
10
|
|
|
8
11
|
## Dependency
|
|
9
12
|
|
|
10
|
-
The library is available via npm.
|
|
11
|
-
|
|
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:
|
|
12
15
|
|
|
13
16
|
yarn:
|
|
14
17
|
|
|
@@ -24,21 +27,25 @@ npm install @stellar/typescript-wallet-sdk
|
|
|
24
27
|
|
|
25
28
|
## Introduction
|
|
26
29
|
|
|
27
|
-
Here's a small example creating main wallet class with default configuration
|
|
30
|
+
Here's a small example creating main wallet class with default configuration
|
|
31
|
+
connected to testnet network:
|
|
28
32
|
|
|
29
33
|
```typescript
|
|
30
34
|
let wallet = walletSdk.Wallet.TestNet();
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
It should later be re-used across the code, as it has access to various useful
|
|
34
|
-
authenticate with the `testanchor` as
|
|
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:
|
|
35
40
|
|
|
36
41
|
```typescript
|
|
37
42
|
const authKey = SigningKeypair.fromSecret("my secret key");
|
|
38
43
|
const anchor = wallet.anchor({ homeDomain: "testanchor.stellar.org" });
|
|
39
44
|
const sep10 = await anchor.sep10();
|
|
40
45
|
|
|
41
|
-
const authToken = await sep10.authenticate({accountKp: authKey});
|
|
46
|
+
const authToken = await sep10.authenticate({ accountKp: authKey });
|
|
42
47
|
```
|
|
43
48
|
|
|
44
|
-
Read
|
|
49
|
+
Read
|
|
50
|
+
[full wallet guide](https://developers.stellar.org/docs/category/build-a-wallet-with-the-wallet-sdk)
|
|
51
|
+
for more info
|
package/examples/sep24/README.md
CHANGED
|
@@ -20,3 +20,20 @@ example.
|
|
|
20
20
|
Progress will be logged in the terminal.
|
|
21
21
|
|
|
22
22
|
_note: the identity values used in the sep24 interactive portal can all be fake_
|
|
23
|
+
|
|
24
|
+
## Changing environment variables
|
|
25
|
+
|
|
26
|
+
If you'd like to use different environment variable values than the default
|
|
27
|
+
ones, you can add a `.env` file. See `.env.example` as an example.
|
|
28
|
+
|
|
29
|
+
The environment variables you can set are:
|
|
30
|
+
|
|
31
|
+
| Variable Name | Description | Default Value |
|
|
32
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------- |
|
|
33
|
+
| ANCHOR_DOMAIN | The anchor domain for your application. | testanchor.stellar.org |
|
|
34
|
+
| ASSET_CODE | The code representing the asset. | USDC |
|
|
35
|
+
| ASSET_ISSUER | The issuer's public key for the asset. | GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5 |
|
|
36
|
+
| SOURCE_ACCOUNT_SECRET | The secret key for the account depositing or withdrawing from the anchor. If none given then a new account will be created. | none |
|
|
37
|
+
| RUN_MAINNET | Set to `true` to run the application on Mainnet. | false |
|
|
38
|
+
| CLIENT_DOMAIN | [SEP-10](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0010.md) client domain used for authentication. | none |
|
|
39
|
+
| CLIENT_SECRET | Secret key for the client domain. Alternatively, you may want to implement your own `WalletSigner`. | none |
|
package/examples/sep24/sep24.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import readline from "readline";
|
|
3
|
+
import path from "path";
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
walletSdk,
|
|
@@ -7,25 +8,48 @@ import {
|
|
|
7
8
|
SigningKeypair,
|
|
8
9
|
Types,
|
|
9
10
|
IssuedAssetId,
|
|
11
|
+
DefaultSigner,
|
|
10
12
|
} from "../../src";
|
|
11
|
-
import { Memo, MemoText } from "stellar-sdk";
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
import { Memo, MemoText, Transaction, TransactionBuilder } from "stellar-sdk";
|
|
14
|
+
|
|
15
|
+
import * as dotenv from "dotenv";
|
|
16
|
+
dotenv.config({ path: path.resolve(__dirname, ".env") });
|
|
17
|
+
|
|
18
|
+
// Grabbing environment variables
|
|
19
|
+
|
|
20
|
+
const anchorDomain = process.env.ANCHOR_DOMAIN || "testanchor.stellar.org";
|
|
21
|
+
const assetCode = process.env.ASSET_CODE || "USDC";
|
|
22
|
+
const assetIssuer =
|
|
23
|
+
process.env.ASSET_ISSUER ||
|
|
24
|
+
"GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5";
|
|
25
|
+
const runMainnet = process.env.RUN_MAINNET || false;
|
|
26
|
+
const sourceAccountSecret = process.env.SOURCE_ACCOUNT_SECRET;
|
|
27
|
+
const clientDomain = process.env.CLIENT_DOMAIN;
|
|
28
|
+
const clientSecret = process.env.CLIENT_SECRET;
|
|
29
|
+
|
|
30
|
+
// Running example
|
|
31
|
+
|
|
32
|
+
let wallet;
|
|
33
|
+
if (runMainnet === "true") {
|
|
34
|
+
console.log("Warning: you are running this script on the public network.");
|
|
35
|
+
wallet = walletSdk.Wallet.MainNet();
|
|
36
|
+
} else {
|
|
37
|
+
wallet = walletSdk.Wallet.TestNet();
|
|
38
|
+
}
|
|
14
39
|
const stellar = wallet.stellar();
|
|
15
|
-
const anchor = wallet.anchor({
|
|
40
|
+
const anchor = wallet.anchor({
|
|
41
|
+
homeDomain: anchorDomain,
|
|
42
|
+
});
|
|
16
43
|
const account = stellar.account();
|
|
17
44
|
|
|
18
45
|
let kp: SigningKeypair;
|
|
19
46
|
|
|
20
|
-
const asset = new IssuedAssetId(
|
|
21
|
-
"USDC",
|
|
22
|
-
"GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
|
|
23
|
-
);
|
|
47
|
+
const asset = new IssuedAssetId(assetCode, assetIssuer);
|
|
24
48
|
|
|
25
49
|
const runSep24 = async () => {
|
|
26
50
|
await createAccount();
|
|
27
51
|
await runDeposit(anchor, kp);
|
|
28
|
-
|
|
52
|
+
runDepositWatcher(anchor);
|
|
29
53
|
|
|
30
54
|
while (!depositDone) {
|
|
31
55
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
@@ -37,11 +61,16 @@ const runSep24 = async () => {
|
|
|
37
61
|
}
|
|
38
62
|
|
|
39
63
|
await runWithdraw(anchor, kp);
|
|
40
|
-
|
|
64
|
+
runWithdrawWatcher(anchor, kp);
|
|
41
65
|
};
|
|
42
66
|
|
|
43
67
|
// Create Account
|
|
44
68
|
const createAccount = async () => {
|
|
69
|
+
if (sourceAccountSecret) {
|
|
70
|
+
kp = SigningKeypair.fromSecret(sourceAccountSecret);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
45
74
|
console.log("creating account ...");
|
|
46
75
|
kp = account.createKeypair();
|
|
47
76
|
console.log(`kp: \n${kp.publicKey}\n${kp.secretKey}`);
|
|
@@ -59,11 +88,15 @@ const createAccount = async () => {
|
|
|
59
88
|
};
|
|
60
89
|
|
|
61
90
|
// Create Deposit
|
|
62
|
-
let authToken:
|
|
91
|
+
let authToken: Types.AuthToken;
|
|
63
92
|
export const runDeposit = async (anchor: Anchor, kp: SigningKeypair) => {
|
|
64
93
|
console.log("\ncreating deposit ...");
|
|
65
94
|
const auth = await anchor.sep10();
|
|
66
|
-
authToken = await auth.authenticate({
|
|
95
|
+
authToken = await auth.authenticate({
|
|
96
|
+
accountKp: kp,
|
|
97
|
+
clientDomain,
|
|
98
|
+
walletSigner,
|
|
99
|
+
});
|
|
67
100
|
|
|
68
101
|
const resp = await anchor.sep24().deposit({
|
|
69
102
|
assetCode: asset.code,
|
|
@@ -85,7 +118,7 @@ export let depositDone = false;
|
|
|
85
118
|
export const runDepositWatcher = (anchor: Anchor) => {
|
|
86
119
|
console.log("\nstarting watcher ...");
|
|
87
120
|
|
|
88
|
-
|
|
121
|
+
const stop: Types.WatcherStopFunction;
|
|
89
122
|
const onMessage = (m: Types.AnchorTransaction) => {
|
|
90
123
|
console.log({ m });
|
|
91
124
|
if (m.status === Types.TransactionStatus.completed) {
|
|
@@ -150,7 +183,7 @@ const sendWithdrawalTransaction = async (withdrawalTxn, kp) => {
|
|
|
150
183
|
export const runWithdrawWatcher = (anchor, kp) => {
|
|
151
184
|
console.log("\nstarting watcher ...");
|
|
152
185
|
|
|
153
|
-
|
|
186
|
+
const stop;
|
|
154
187
|
const onMessage = (m) => {
|
|
155
188
|
console.log({ m });
|
|
156
189
|
|
|
@@ -182,6 +215,28 @@ export const runWithdrawWatcher = (anchor, kp) => {
|
|
|
182
215
|
stop = resp.stop;
|
|
183
216
|
};
|
|
184
217
|
|
|
218
|
+
const walletSigner = DefaultSigner;
|
|
219
|
+
walletSigner.signWithDomainAccount = async ({
|
|
220
|
+
transactionXDR,
|
|
221
|
+
networkPassphrase,
|
|
222
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
223
|
+
accountKp,
|
|
224
|
+
}: Types.SignWithDomainAccountParams): Promise<Transaction> => {
|
|
225
|
+
if (!clientSecret) {
|
|
226
|
+
throw new Error("Client Secret missing from .env file");
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const signer = SigningKeypair.fromSecret(clientSecret);
|
|
230
|
+
|
|
231
|
+
const transaction = TransactionBuilder.fromXDR(
|
|
232
|
+
transactionXDR,
|
|
233
|
+
networkPassphrase,
|
|
234
|
+
) as Transaction;
|
|
235
|
+
signer.sign(transaction);
|
|
236
|
+
|
|
237
|
+
return Promise.resolve(transaction);
|
|
238
|
+
};
|
|
239
|
+
|
|
185
240
|
export const askQuestion = (query) => {
|
|
186
241
|
const rl = readline.createInterface({
|
|
187
242
|
input: process.stdin,
|
package/jest.config.js
CHANGED