@stellar/typescript-wallet-sdk 1.6.0 → 1.7.0-beta.1720449817870
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/CHANGELOG.MD +20 -0
- package/jest.e2e.config.js +1 -0
- package/jest.integration.config.js +1 -0
- package/lib/bundle.js +180 -97
- package/lib/bundle.js.map +1 -1
- package/lib/bundle_browser.js +208 -108
- package/lib/bundle_browser.js.map +1 -1
- package/lib/index.d.ts +6 -3
- package/lib/walletSdk/Anchor/Sep24.d.ts +4 -0
- package/lib/walletSdk/Anchor/Sep38.d.ts +4 -0
- package/lib/walletSdk/Anchor/Sep6.d.ts +4 -0
- package/lib/walletSdk/Anchor/index.d.ts +5 -10
- package/lib/walletSdk/Asset/index.d.ts +3 -0
- package/lib/walletSdk/Auth/index.d.ts +5 -1
- package/lib/walletSdk/Customer/index.d.ts +4 -0
- package/package.json +4 -3
- package/src/index.ts +18 -3
- package/src/walletSdk/Anchor/Sep24.ts +5 -0
- package/src/walletSdk/Anchor/Sep38.ts +5 -0
- package/src/walletSdk/Anchor/Sep6.ts +5 -0
- package/src/walletSdk/Anchor/index.ts +5 -15
- package/src/walletSdk/Asset/index.ts +3 -0
- package/src/walletSdk/Auth/AuthHeaderSigner.ts +3 -5
- package/src/walletSdk/Auth/index.ts +6 -1
- package/src/walletSdk/Customer/index.ts +5 -0
package/lib/index.d.ts
CHANGED
|
@@ -8,10 +8,13 @@ export { Types };
|
|
|
8
8
|
*/
|
|
9
9
|
export { Wallet, Config, StellarConfiguration, ApplicationConfiguration, } from "./walletSdk";
|
|
10
10
|
export { Anchor } from "./walletSdk/Anchor";
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
11
|
+
export { Sep6, Transfer } from "./walletSdk/Anchor/Sep6";
|
|
12
|
+
export { Sep24, Interactive } from "./walletSdk/Anchor/Sep24";
|
|
13
|
+
export { Sep38, Quote } from "./walletSdk/Anchor/Sep38";
|
|
14
|
+
export { StellarAssetId, IssuedAssetId, NativeAssetId, XLM, FiatAssetId, } from "./walletSdk/Asset";
|
|
15
|
+
export { Sep10, Auth, WalletSigner, DefaultSigner, DomainSigner, } from "./walletSdk/Auth";
|
|
14
16
|
export { AuthHeaderSigner, DefaultAuthHeaderSigner, DomainAuthHeaderSigner, } from "./walletSdk/Auth/AuthHeaderSigner";
|
|
17
|
+
export { Sep12, Customer } from "./walletSdk/Customer";
|
|
15
18
|
export { AccountKeypair, PublicKeypair, SigningKeypair, AccountService, Stellar, CommonTransactionBuilder, TransactionBuilder, SponsoringBuilder, } from "./walletSdk/Horizon";
|
|
16
19
|
export { Recovery } from "./walletSdk/Recovery";
|
|
17
20
|
export { Sep7Base, Sep7Pay, Sep7Tx, isValidSep7Uri, parseSep7Uri, sep7ReplacementsFromString, sep7ReplacementsToString, } from "./walletSdk/Uri";
|
|
@@ -6,6 +6,10 @@ type Sep24Params = {
|
|
|
6
6
|
anchor: Anchor;
|
|
7
7
|
httpClient: AxiosInstance;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* @alias Interactive alias for Sep24 class.
|
|
11
|
+
*/
|
|
12
|
+
export type Interactive = Sep24;
|
|
9
13
|
/**
|
|
10
14
|
* Interactive flow for deposit and withdrawal using SEP-24.
|
|
11
15
|
* @see {@link https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0024.md}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Sep38Info, Sep38Params, Sep38PricesParams, Sep38PriceParams, Sep38PricesResponse, Sep38PriceResponse, Sep38PostQuoteParams, Sep38PostQuoteResponse } from "../Types";
|
|
2
|
+
/**
|
|
3
|
+
* @alias Quote alias for Sep38 class.
|
|
4
|
+
*/
|
|
5
|
+
export type Quote = Sep38;
|
|
2
6
|
/**
|
|
3
7
|
* Quote service using SEP-38. It can be used for getting price quotes from an anchor
|
|
4
8
|
* for exchanging assets.
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Sep6Info, Sep6Params, Sep6DepositParams, Sep6WithdrawParams, Sep6DepositResponse, Sep6WithdrawResponse, Sep6ExchangeParams, Sep6Transaction, GetTransactionParams, GetTransactionsParams, AuthToken } from "../Types";
|
|
2
2
|
import { Watcher } from "../Watcher";
|
|
3
|
+
/**
|
|
4
|
+
* @alias Transfer alias for Sep6 class.
|
|
5
|
+
*/
|
|
6
|
+
export type Transfer = Sep6;
|
|
3
7
|
/**
|
|
4
8
|
* Flow for creating deposits and withdrawals with an anchor using SEP-6.
|
|
5
9
|
* For an interactive flow use Sep24 instead.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { Config } from "../";
|
|
3
|
-
import { Sep10 } from "../Auth";
|
|
4
|
-
import { Sep12 } from "../Customer";
|
|
5
|
-
import { Sep6 } from "./Sep6";
|
|
6
|
-
import { Sep24 } from "./Sep24";
|
|
7
|
-
import { Sep38 } from "./Sep38";
|
|
3
|
+
import { Auth, Sep10 } from "../Auth";
|
|
4
|
+
import { Customer, Sep12 } from "../Customer";
|
|
5
|
+
import { Sep6, Transfer } from "./Sep6";
|
|
6
|
+
import { Interactive, Sep24 } from "./Sep24";
|
|
7
|
+
import { Quote, Sep38 } from "./Sep38";
|
|
8
8
|
import { AnchorServiceInfo, TomlInfo, AuthToken } from "../Types";
|
|
9
9
|
type AnchorParams = {
|
|
10
10
|
cfg: Config;
|
|
@@ -13,11 +13,6 @@ type AnchorParams = {
|
|
|
13
13
|
httpClient: AxiosInstance;
|
|
14
14
|
language: string;
|
|
15
15
|
};
|
|
16
|
-
export type Transfer = Sep6;
|
|
17
|
-
export type Auth = Sep10;
|
|
18
|
-
export type Customer = Sep12;
|
|
19
|
-
export type Interactive = Sep24;
|
|
20
|
-
export type Quote = Sep38;
|
|
21
16
|
/**
|
|
22
17
|
* Build on/off ramps with anchors.
|
|
23
18
|
* Do not create this object directly, use the Wallet class.
|
|
@@ -15,6 +15,9 @@ export declare class IssuedAssetId extends StellarAssetId {
|
|
|
15
15
|
constructor(code: string, issuer: string);
|
|
16
16
|
toString(): string;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* @alias XLM alias for NativeAssetId class.
|
|
20
|
+
*/
|
|
18
21
|
export type XLM = NativeAssetId;
|
|
19
22
|
export declare class NativeAssetId extends StellarAssetId {
|
|
20
23
|
id: string;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { Config } from "../";
|
|
3
3
|
import { AuthenticateParams, AuthToken } from "../Types";
|
|
4
|
-
export { WalletSigner, DefaultSigner } from "./WalletSigner";
|
|
4
|
+
export { WalletSigner, DomainSigner, DefaultSigner } from "./WalletSigner";
|
|
5
5
|
type Sep10Params = {
|
|
6
6
|
cfg: Config;
|
|
7
7
|
webAuthEndpoint: string;
|
|
8
8
|
homeDomain: string;
|
|
9
9
|
httpClient: AxiosInstance;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* @alias Auth alias for Sep10 class.
|
|
13
|
+
*/
|
|
14
|
+
export type Auth = Sep10;
|
|
11
15
|
/**
|
|
12
16
|
* Sep-10 used for authentication to an external server.
|
|
13
17
|
* @see {@link https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0010.md}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
2
|
import { GetCustomerParams, GetCustomerResponse, AddCustomerResponse, AddCustomerParams, AuthToken } from "../Types";
|
|
3
|
+
/**
|
|
4
|
+
* @alias Customer alias for Sep12 class.
|
|
5
|
+
*/
|
|
6
|
+
export type Customer = Sep12;
|
|
3
7
|
/**
|
|
4
8
|
* KYC management with Sep-12.
|
|
5
9
|
* @see {@link https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0012.md}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stellar/typescript-wallet-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0-beta.1720449817870",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=18"
|
|
6
6
|
},
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
"webpack-cli": "^5.1.1"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
+
"@stablelib/base64": "^2.0.0",
|
|
48
|
+
"@stablelib/utf8": "^2.0.0",
|
|
47
49
|
"@stellar/stellar-sdk": "12.1.0",
|
|
48
50
|
"axios": "^1.4.0",
|
|
49
51
|
"base64url": "^3.0.1",
|
|
@@ -53,7 +55,6 @@
|
|
|
53
55
|
"query-string": "^7.1.3",
|
|
54
56
|
"stream-http": "^3.2.0",
|
|
55
57
|
"tweetnacl": "^1.0.3",
|
|
56
|
-
"tweetnacl-util": "^0.15.1",
|
|
57
58
|
"url": "^0.11.0",
|
|
58
59
|
"util": "^0.12.5",
|
|
59
60
|
"utility-types": "^3.10.0",
|
|
@@ -70,4 +71,4 @@
|
|
|
70
71
|
"build": "run-p build:web build:node",
|
|
71
72
|
"example:sep24": "ts-node examples/sep24/sep24.ts"
|
|
72
73
|
}
|
|
73
|
-
}
|
|
74
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -14,14 +14,29 @@ export {
|
|
|
14
14
|
ApplicationConfiguration,
|
|
15
15
|
} from "./walletSdk";
|
|
16
16
|
export { Anchor } from "./walletSdk/Anchor";
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
17
|
+
export { Sep6, Transfer } from "./walletSdk/Anchor/Sep6";
|
|
18
|
+
export { Sep24, Interactive } from "./walletSdk/Anchor/Sep24";
|
|
19
|
+
export { Sep38, Quote } from "./walletSdk/Anchor/Sep38";
|
|
20
|
+
export {
|
|
21
|
+
StellarAssetId,
|
|
22
|
+
IssuedAssetId,
|
|
23
|
+
NativeAssetId,
|
|
24
|
+
XLM,
|
|
25
|
+
FiatAssetId,
|
|
26
|
+
} from "./walletSdk/Asset";
|
|
27
|
+
export {
|
|
28
|
+
Sep10,
|
|
29
|
+
Auth,
|
|
30
|
+
WalletSigner,
|
|
31
|
+
DefaultSigner,
|
|
32
|
+
DomainSigner,
|
|
33
|
+
} from "./walletSdk/Auth";
|
|
20
34
|
export {
|
|
21
35
|
AuthHeaderSigner,
|
|
22
36
|
DefaultAuthHeaderSigner,
|
|
23
37
|
DomainAuthHeaderSigner,
|
|
24
38
|
} from "./walletSdk/Auth/AuthHeaderSigner";
|
|
39
|
+
export { Sep12, Customer } from "./walletSdk/Customer";
|
|
25
40
|
export {
|
|
26
41
|
AccountKeypair,
|
|
27
42
|
PublicKeypair,
|
|
@@ -30,6 +30,11 @@ type Sep24Params = {
|
|
|
30
30
|
httpClient: AxiosInstance;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @alias Interactive alias for Sep24 class.
|
|
35
|
+
*/
|
|
36
|
+
export type Interactive = Sep24;
|
|
37
|
+
|
|
33
38
|
/**
|
|
34
39
|
* Interactive flow for deposit and withdrawal using SEP-24.
|
|
35
40
|
* @see {@link https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0024.md}
|
|
@@ -20,6 +20,11 @@ import {
|
|
|
20
20
|
} from "../Types";
|
|
21
21
|
import { camelToSnakeCaseObject } from "../Utils";
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @alias Quote alias for Sep38 class.
|
|
25
|
+
*/
|
|
26
|
+
export type Quote = Sep38;
|
|
27
|
+
|
|
23
28
|
/**
|
|
24
29
|
* Quote service using SEP-38. It can be used for getting price quotes from an anchor
|
|
25
30
|
* for exchanging assets.
|
|
@@ -27,6 +27,11 @@ import {
|
|
|
27
27
|
} from "../Watcher";
|
|
28
28
|
import { camelToSnakeCaseObject } from "../Utils";
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @alias Transfer alias for Sep6 class.
|
|
32
|
+
*/
|
|
33
|
+
export type Transfer = Sep6;
|
|
34
|
+
|
|
30
35
|
/**
|
|
31
36
|
* Flow for creating deposits and withdrawals with an anchor using SEP-6.
|
|
32
37
|
* For an interactive flow use Sep24 instead.
|
|
@@ -2,15 +2,15 @@ import { AxiosInstance } from "axios";
|
|
|
2
2
|
import { StellarToml } from "@stellar/stellar-sdk";
|
|
3
3
|
|
|
4
4
|
import { Config } from "../";
|
|
5
|
-
import { Sep10 } from "../Auth";
|
|
6
|
-
import { Sep12 } from "../Customer";
|
|
5
|
+
import { Auth, Sep10 } from "../Auth";
|
|
6
|
+
import { Customer, Sep12 } from "../Customer";
|
|
7
7
|
import {
|
|
8
8
|
ServerRequestFailedError,
|
|
9
9
|
KYCServerNotFoundError,
|
|
10
10
|
} from "../Exceptions";
|
|
11
|
-
import { Sep6 } from "./Sep6";
|
|
12
|
-
import { Sep24 } from "./Sep24";
|
|
13
|
-
import { Sep38 } from "./Sep38";
|
|
11
|
+
import { Sep6, Transfer } from "./Sep6";
|
|
12
|
+
import { Interactive, Sep24 } from "./Sep24";
|
|
13
|
+
import { Quote, Sep38 } from "./Sep38";
|
|
14
14
|
import { AnchorServiceInfo, TomlInfo, AuthToken } from "../Types";
|
|
15
15
|
import { parseToml } from "../Utils";
|
|
16
16
|
|
|
@@ -24,16 +24,6 @@ type AnchorParams = {
|
|
|
24
24
|
language: string;
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export type Transfer = Sep6;
|
|
28
|
-
|
|
29
|
-
export type Auth = Sep10;
|
|
30
|
-
|
|
31
|
-
export type Customer = Sep12;
|
|
32
|
-
|
|
33
|
-
export type Interactive = Sep24;
|
|
34
|
-
|
|
35
|
-
export type Quote = Sep38;
|
|
36
|
-
|
|
37
27
|
/**
|
|
38
28
|
* Build on/off ramps with anchors.
|
|
39
29
|
* Do not create this object directly, use the Wallet class.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
+
import { encode as utf8Encode } from "@stablelib/utf8";
|
|
2
3
|
import { StrKey } from "@stellar/stellar-sdk";
|
|
3
4
|
import nacl from "tweetnacl";
|
|
4
|
-
import naclUtil from "tweetnacl-util";
|
|
5
5
|
import base64url from "base64url";
|
|
6
6
|
|
|
7
7
|
import { SigningKeypair } from "../Horizon/Account";
|
|
@@ -66,12 +66,10 @@ export class DefaultAuthHeaderSigner implements AuthHeaderSigner {
|
|
|
66
66
|
const encodedPayload = base64url(
|
|
67
67
|
JSON.stringify({ ...claims, exp: timeExp, iat: issuedAt }),
|
|
68
68
|
);
|
|
69
|
+
const utf8Jwt = utf8Encode(`${encodedHeader}.${encodedPayload}`);
|
|
69
70
|
|
|
70
71
|
// sign JWT and create signature
|
|
71
|
-
const signature = nacl.sign.detached(
|
|
72
|
-
naclUtil.decodeUTF8(`${encodedHeader}.${encodedPayload}`),
|
|
73
|
-
naclKP.secretKey,
|
|
74
|
-
);
|
|
72
|
+
const signature = nacl.sign.detached(utf8Jwt, naclKP.secretKey);
|
|
75
73
|
const encodedSignature = base64url(Buffer.from(signature));
|
|
76
74
|
|
|
77
75
|
const jwt = `${encodedHeader}.${encodedPayload}.${encodedSignature}`;
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import { AccountKeypair } from "../Horizon/Account";
|
|
23
23
|
import { AuthHeaderSigner } from "./AuthHeaderSigner";
|
|
24
24
|
|
|
25
|
-
export { WalletSigner, DefaultSigner } from "./WalletSigner";
|
|
25
|
+
export { WalletSigner, DomainSigner, DefaultSigner } from "./WalletSigner";
|
|
26
26
|
|
|
27
27
|
// Let's prevent exporting this constructor type as
|
|
28
28
|
// we should not create this Anchor class directly.
|
|
@@ -33,6 +33,11 @@ type Sep10Params = {
|
|
|
33
33
|
httpClient: AxiosInstance;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @alias Auth alias for Sep10 class.
|
|
38
|
+
*/
|
|
39
|
+
export type Auth = Sep10;
|
|
40
|
+
|
|
36
41
|
/**
|
|
37
42
|
* Sep-10 used for authentication to an external server.
|
|
38
43
|
* @see {@link https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0010.md}
|
|
@@ -10,6 +10,11 @@ import {
|
|
|
10
10
|
AuthToken,
|
|
11
11
|
} from "../Types";
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @alias Customer alias for Sep12 class.
|
|
15
|
+
*/
|
|
16
|
+
export type Customer = Sep12;
|
|
17
|
+
|
|
13
18
|
/**
|
|
14
19
|
* KYC management with Sep-12.
|
|
15
20
|
* @see {@link https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0012.md}
|