@stellar/typescript-wallet-sdk 1.1.0-alpha.2 → 1.1.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/.husky/pre-commit +4 -0
- package/docs/WalletGuide.md +5 -0
- package/lib/bundle.js +15519 -18948
- package/lib/bundle.js.map +1 -1
- package/lib/bundle_browser.js +89069 -0
- package/lib/bundle_browser.js.map +1 -0
- package/lib/index.d.ts +26 -7
- package/lib/walletSdk/Anchor/Sep24.d.ts +48 -0
- package/lib/walletSdk/Anchor/index.d.ts +24 -0
- package/lib/walletSdk/Asset/index.d.ts +27 -0
- package/lib/walletSdk/Auth/WalletSigner.d.ts +7 -0
- package/lib/walletSdk/Auth/index.d.ts +21 -0
- package/lib/walletSdk/Exceptions/index.d.ts +56 -0
- package/lib/walletSdk/{horizon → Horizon}/Account.d.ts +3 -6
- package/lib/walletSdk/Horizon/AccountService.d.ts +53 -0
- package/lib/walletSdk/Horizon/Stellar.d.ts +16 -0
- package/lib/walletSdk/Horizon/Transaction/TransactionBuilder.d.ts +20 -0
- package/lib/walletSdk/Horizon/index.d.ts +4 -0
- package/lib/walletSdk/Recovery/index.d.ts +18 -0
- package/lib/walletSdk/{Watcher/Types.d.ts → Types/anchor.d.ts} +89 -6
- package/lib/walletSdk/Types/auth.d.ts +35 -0
- package/lib/walletSdk/Types/horizon.d.ts +34 -0
- package/lib/walletSdk/Types/index.d.ts +30 -0
- package/lib/walletSdk/Types/sep24.d.ts +30 -0
- package/lib/walletSdk/{toml/index.d.ts → Types/utils.d.ts} +4 -5
- package/lib/walletSdk/Types/watcher.d.ts +30 -0
- package/lib/walletSdk/{util → Utils}/camelToSnakeCase.d.ts +1 -1
- package/lib/walletSdk/Utils/getResultCode.d.ts +1 -0
- package/lib/walletSdk/Utils/index.d.ts +3 -0
- package/lib/walletSdk/Utils/toml.d.ts +3 -0
- package/lib/walletSdk/Utils/url.d.ts +1 -0
- package/lib/walletSdk/Watcher/index.d.ts +21 -42
- package/lib/walletSdk/index.d.ts +17 -15
- package/package.json +12 -2
- package/prettier.config.js +1 -0
- package/src/index.ts +39 -17
- package/src/walletSdk/Anchor/Sep24.ts +267 -0
- package/src/walletSdk/Anchor/index.ts +32 -201
- package/src/walletSdk/Asset/index.ts +58 -0
- package/src/walletSdk/Auth/WalletSigner.ts +23 -12
- package/src/walletSdk/Auth/index.ts +96 -49
- package/src/walletSdk/Exceptions/index.ts +148 -0
- package/src/walletSdk/{horizon → Horizon}/Account.ts +7 -9
- package/src/walletSdk/Horizon/AccountService.ts +96 -0
- package/src/walletSdk/Horizon/Stellar.ts +164 -0
- package/src/walletSdk/Horizon/Transaction/TransactionBuilder.ts +140 -0
- package/src/walletSdk/Horizon/index.ts +4 -0
- package/src/walletSdk/Recovery/index.ts +32 -0
- package/src/walletSdk/{Watcher/Types.ts → Types/anchor.ts} +114 -21
- package/src/walletSdk/Types/auth.ts +43 -0
- package/src/walletSdk/Types/horizon.ts +40 -0
- package/src/walletSdk/Types/index.ts +39 -0
- package/src/walletSdk/Types/sep24.ts +41 -0
- package/src/walletSdk/Types/utils.ts +77 -0
- package/src/walletSdk/Types/watcher.ts +34 -0
- package/src/walletSdk/Utils/camelToSnakeCase.ts +16 -0
- package/src/walletSdk/Utils/getResultCode.ts +5 -0
- package/src/walletSdk/Utils/index.ts +3 -0
- package/src/walletSdk/Utils/toml.ts +103 -0
- package/src/walletSdk/{util → Utils}/url.ts +1 -1
- package/src/walletSdk/Watcher/index.ts +137 -128
- package/src/walletSdk/index.ts +72 -55
- package/test/account.test.ts +19 -15
- package/test/accountService.test.ts +109 -0
- package/test/fixtures/TransactionsResponse.ts +144 -127
- package/test/stellar.test.ts +247 -0
- package/test/wallet.test.ts +196 -214
- package/tsconfig.json +3 -7
- package/webpack.config.js +7 -4
- package/lib/walletSdk/anchor/Types.d.ts +0 -75
- package/lib/walletSdk/anchor/index.d.ts +0 -87
- package/lib/walletSdk/auth/WalletSigner.d.ts +0 -6
- package/lib/walletSdk/auth/index.d.ts +0 -12
- package/lib/walletSdk/exception/index.d.ts +0 -21
- package/lib/walletSdk/horizon/AccountService.d.ts +0 -8
- package/lib/walletSdk/horizon/Stellar.d.ts +0 -7
- package/lib/walletSdk/horizon/constants.d.ts +0 -4
- package/lib/walletSdk/interactive/index.d.ts +0 -38
- package/lib/walletSdk/recovery/Recovery.d.ts +0 -3
- package/lib/walletSdk/util/sleep.d.ts +0 -1
- package/lib/walletSdk/util/url.d.ts +0 -1
- package/src/walletSdk/Anchor/Types.ts +0 -83
- package/src/walletSdk/exception/index.ts +0 -48
- package/src/walletSdk/horizon/AccountService.ts +0 -19
- package/src/walletSdk/horizon/Stellar.ts +0 -14
- package/src/walletSdk/horizon/constants.ts +0 -4
- package/src/walletSdk/interactive/index.ts +0 -105
- package/src/walletSdk/recovery/Recovery.ts +0 -6
- package/src/walletSdk/toml/index.ts +0 -179
- package/src/walletSdk/util/camelToSnakeCase.ts +0 -13
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export type TomlInfo = {
|
|
3
|
-
version: string;
|
|
4
|
-
networkPassphrase: string;
|
|
5
|
-
federationServer: string;
|
|
6
|
-
authServer: string;
|
|
7
|
-
transferServer: string;
|
|
8
|
-
transferServerSep24: string;
|
|
9
|
-
kycServer: string;
|
|
10
|
-
webAuthEndpoint: string;
|
|
11
|
-
signingKey: string;
|
|
12
|
-
horizonUrl: string;
|
|
13
|
-
accounts: Array<string>;
|
|
14
|
-
uriRequestSigningKey: string;
|
|
15
|
-
directPaymentServer: string;
|
|
16
|
-
anchorQuoteServer: string;
|
|
17
|
-
documentation: {
|
|
18
|
-
orgName: string;
|
|
19
|
-
orgDba: string;
|
|
20
|
-
orgUrl: string;
|
|
21
|
-
orgLogo: string;
|
|
22
|
-
orgDescription: string;
|
|
23
|
-
orgPhysicalAddress: string;
|
|
24
|
-
orgPhysicalAddressAttestation: string;
|
|
25
|
-
orgPhoneNumber: string;
|
|
26
|
-
orgPhoneNumberAttestation: string;
|
|
27
|
-
orgKeybase: string;
|
|
28
|
-
orgTwitter: string;
|
|
29
|
-
orgGithub: string;
|
|
30
|
-
orgOfficialEmail: string;
|
|
31
|
-
orgSupportEmail: string;
|
|
32
|
-
orgLicensingAuthority: string;
|
|
33
|
-
orgLicenseType: string;
|
|
34
|
-
orgLicenseNumber: string;
|
|
35
|
-
};
|
|
36
|
-
principals: Array<{
|
|
37
|
-
name: string;
|
|
38
|
-
email: string;
|
|
39
|
-
keybase: string;
|
|
40
|
-
telegram: string;
|
|
41
|
-
twitter: string;
|
|
42
|
-
github: string;
|
|
43
|
-
idPhotoHash: string;
|
|
44
|
-
verificationPhotoHash: string;
|
|
45
|
-
}>;
|
|
46
|
-
currencies: Array<{
|
|
47
|
-
code: string;
|
|
48
|
-
codeTemplate: string;
|
|
49
|
-
issuer: string;
|
|
50
|
-
status: string;
|
|
51
|
-
displayDecimals: string;
|
|
52
|
-
name: string;
|
|
53
|
-
desc: string;
|
|
54
|
-
conditions: string;
|
|
55
|
-
image: string;
|
|
56
|
-
fixedNumber: string;
|
|
57
|
-
maxNumber: string;
|
|
58
|
-
isUnlimited: boolean;
|
|
59
|
-
isAssetAnchored: boolean;
|
|
60
|
-
anchorAssetType: string;
|
|
61
|
-
anchorAsset: string;
|
|
62
|
-
attestationOfReserve: string;
|
|
63
|
-
redemptionInstructions: string;
|
|
64
|
-
collateralAddresses: Array<string>;
|
|
65
|
-
collateralAddressMessages: Array<string>;
|
|
66
|
-
collateralAddressSignatures: Array<string>;
|
|
67
|
-
regulated: string;
|
|
68
|
-
approvalServer: string;
|
|
69
|
-
approvalCriteria: string;
|
|
70
|
-
}>;
|
|
71
|
-
validators: Array<{
|
|
72
|
-
alias: string;
|
|
73
|
-
displayName: string;
|
|
74
|
-
publicKey: string;
|
|
75
|
-
host: string;
|
|
76
|
-
history: string;
|
|
77
|
-
}>;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const parseToml = (toml): TomlInfo => {
|
|
81
|
-
const tomlDocumentation = toml["DOCUMENTATION"];
|
|
82
|
-
const documentation = {
|
|
83
|
-
orgName: tomlDocumentation["ORG_NAME"],
|
|
84
|
-
orgDba: tomlDocumentation["ORG_DBA"],
|
|
85
|
-
orgUrl: tomlDocumentation["ORG_URL"],
|
|
86
|
-
orgLogo: tomlDocumentation["ORG_LOGO"],
|
|
87
|
-
orgDescription: tomlDocumentation["ORG_DESCRIPTION"],
|
|
88
|
-
orgPhysicalAddress: tomlDocumentation["ORG_PHYSICAL_ADDRESS"],
|
|
89
|
-
orgPhysicalAddressAttestation:
|
|
90
|
-
tomlDocumentation["ORG_PHYSICAL_ADDRESS_ATTESTATION"],
|
|
91
|
-
orgPhoneNumber: tomlDocumentation["ORG_PHONE_NUMBER"],
|
|
92
|
-
orgPhoneNumberAttestation:
|
|
93
|
-
tomlDocumentation["ORG_PHONE_NUMBER_ATTESTATION"],
|
|
94
|
-
orgKeybase: tomlDocumentation["ORG_KEYBASE"],
|
|
95
|
-
orgTwitter: tomlDocumentation["ORG_TWITTER"],
|
|
96
|
-
orgGithub: tomlDocumentation["ORG_GITHUB"],
|
|
97
|
-
orgOfficialEmail: tomlDocumentation["ORG_OFFICIAL_EMAIL"],
|
|
98
|
-
orgSupportEmail: tomlDocumentation["ORG_SUPPORT_EMAIL"],
|
|
99
|
-
orgLicensingAuthority: tomlDocumentation["ORG_LICENSING_AUTHORITY"],
|
|
100
|
-
orgLicenseType: tomlDocumentation["ORG_LICENSE_TYPE"],
|
|
101
|
-
orgLicenseNumber: tomlDocumentation["ORG_LICENSE_NUMBER"],
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
const tomlPrincipals = toml["PRINCIPALS"] || [];
|
|
105
|
-
const principals = tomlPrincipals.map((tp) => {
|
|
106
|
-
return {
|
|
107
|
-
name: tp["name"],
|
|
108
|
-
email: tp["email"],
|
|
109
|
-
keybase: tp["keybase"],
|
|
110
|
-
telegram: tp["telegram"],
|
|
111
|
-
twitter: tp["twitter"],
|
|
112
|
-
github: tp["github"],
|
|
113
|
-
idPhotoHash: tp["id_photo_hash"],
|
|
114
|
-
verificationPhotoHash: tp["verification_photo_hash"],
|
|
115
|
-
};
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
const tomlCurrencies = toml["CURRENCIES"] || [];
|
|
119
|
-
const currencies = tomlCurrencies.map((tc) => {
|
|
120
|
-
return {
|
|
121
|
-
code: tomlCurrencies["code"],
|
|
122
|
-
codeTemplate: tomlCurrencies["code_template"],
|
|
123
|
-
issuer: tomlCurrencies["issuer"],
|
|
124
|
-
status: tomlCurrencies["status"],
|
|
125
|
-
displayDecimals: tomlCurrencies["display_decimals"],
|
|
126
|
-
name: tomlCurrencies["name"],
|
|
127
|
-
desc: tomlCurrencies["desc"],
|
|
128
|
-
conditions: tomlCurrencies["conditions"],
|
|
129
|
-
image: tomlCurrencies["image"],
|
|
130
|
-
fixedNumber: tomlCurrencies["fixed_number"],
|
|
131
|
-
maxNumber: tomlCurrencies["max_number"],
|
|
132
|
-
isUnlimited: tomlCurrencies["is_unlimited"],
|
|
133
|
-
isAssetAnchored: tomlCurrencies["is_asset_anchored"],
|
|
134
|
-
anchorAssetType: tomlCurrencies["anchor_asset_type"],
|
|
135
|
-
anchorAsset: tomlCurrencies["anchor_asset"],
|
|
136
|
-
attestationOfReserve: tomlCurrencies["attestation_of_reserve"],
|
|
137
|
-
redemptionInstructions: tomlCurrencies["redemption_instructions"],
|
|
138
|
-
collateralAddresses: tomlCurrencies["collateral_addresses"],
|
|
139
|
-
collateralAddressMessages: tomlCurrencies["collateral_address_messages"],
|
|
140
|
-
collateralAddressSignatures:
|
|
141
|
-
tomlCurrencies["collateral_address_signatures"],
|
|
142
|
-
regulated: tomlCurrencies["regulated"],
|
|
143
|
-
approvalServer: tomlCurrencies["approval_server"],
|
|
144
|
-
approvalCriteria: tomlCurrencies["approval_criteria"],
|
|
145
|
-
};
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
const tomlValidators = toml["VALIDATORS"] || [];
|
|
149
|
-
const validators = tomlValidators.map((tv) => {
|
|
150
|
-
return {
|
|
151
|
-
alias: tomlValidators["ALIAS"],
|
|
152
|
-
displayName: tomlValidators["DISPLAY_NAME"],
|
|
153
|
-
publicKey: tomlValidators["PUBLIC_KEY"],
|
|
154
|
-
host: tomlValidators["HOST"],
|
|
155
|
-
history: tomlValidators["HISTORY"],
|
|
156
|
-
};
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
version: toml["VERSION"],
|
|
161
|
-
networkPassphrase: toml["NETWORK_PASSPHRASE"],
|
|
162
|
-
federationServer: toml["FEDERATION_SERVER"],
|
|
163
|
-
authServer: toml["AUTH_SERVER"],
|
|
164
|
-
transferServer: toml["TRANSFER_SERVER"],
|
|
165
|
-
transferServerSep24: toml["TRANSFER_SERVER_SEP0024"],
|
|
166
|
-
kycServer: toml["KYC_SERVER"],
|
|
167
|
-
webAuthEndpoint: toml["WEB_AUTH_ENDPOINT"],
|
|
168
|
-
signingKey: toml["SIGNING_KEY"],
|
|
169
|
-
horizonUrl: toml["HORIZON_URL"],
|
|
170
|
-
accounts: toml["ACCOUNTS"],
|
|
171
|
-
uriRequestSigningKey: toml["URI_REQUEST_SIGNING_KEY"],
|
|
172
|
-
directPaymentServer: toml["DIRECT_PAYMENT_SERVER"],
|
|
173
|
-
anchorQuoteServer: toml["ANCHOR_QUOTE_SERVER"],
|
|
174
|
-
documentation,
|
|
175
|
-
principals,
|
|
176
|
-
currencies,
|
|
177
|
-
validators,
|
|
178
|
-
};
|
|
179
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const camelToSnakeCaseKey = (key: string) =>
|
|
2
|
-
key.replace(/[A-Z]/g, upperCaseLetter => `_${upperCaseLetter.toLowerCase()}`);
|
|
3
|
-
|
|
4
|
-
export const camelToSnakeCaseObject = (obj: any) => {
|
|
5
|
-
const snakeCasedObj = {};
|
|
6
|
-
for (const key in obj) {
|
|
7
|
-
if (obj.hasOwnProperty(key)) {
|
|
8
|
-
const snakeCaseKey = camelToSnakeCaseKey(key);
|
|
9
|
-
snakeCasedObj[snakeCaseKey] = obj[key];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return snakeCasedObj;
|
|
13
|
-
}
|