@dynamic-labs-wallet/stellar 0.0.323 → 0.0.325
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/package.json +2 -2
- package/src/client/client.d.ts +63 -0
- package/src/client/client.d.ts.map +1 -0
- package/src/client/constants.d.ts +20 -0
- package/src/client/constants.d.ts.map +1 -0
- package/src/client/index.d.ts +2 -0
- package/src/client/index.d.ts.map +1 -0
- package/src/index.d.ts +4 -0
- package/src/index.d.ts.map +1 -0
- package/src/utils/deriveStellarAddress/deriveStellarAddress.d.ts +21 -0
- package/src/utils/deriveStellarAddress/deriveStellarAddress.d.ts.map +1 -0
- package/src/utils/deriveStellarAddress/index.d.ts +2 -0
- package/src/utils/deriveStellarAddress/index.d.ts.map +1 -0
- package/src/utils/getNetworkPassphrase/getNetworkPassphrase.d.ts +10 -0
- package/src/utils/getNetworkPassphrase/getNetworkPassphrase.d.ts.map +1 -0
- package/src/utils/getNetworkPassphrase/index.d.ts +2 -0
- package/src/utils/getNetworkPassphrase/index.d.ts.map +1 -0
- package/src/utils/index.d.ts +3 -0
- package/src/utils/index.d.ts.map +1 -0
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/stellar",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.325",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/browser": "0.0.
|
|
7
|
+
"@dynamic-labs-wallet/browser": "0.0.325",
|
|
8
8
|
"@stellar/stellar-sdk": "^12.3.0",
|
|
9
9
|
"@dynamic-labs/sdk-api-core": "^0.0.900"
|
|
10
10
|
},
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DynamicWalletClient, type ClientKeyShare, type DynamicWalletClientInternalOptions, type DynamicWalletClientProps, type ThresholdSignatureScheme, type RequestWithElevatedAccessToken } from '@dynamic-labs-wallet/browser';
|
|
2
|
+
import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
export declare class DynamicStellarWalletClient extends DynamicWalletClient {
|
|
4
|
+
readonly chainName = "STELLAR";
|
|
5
|
+
constructor({ environmentId, authToken, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, featureFlags, authMode, sdkVersion, forwardMPCClient, logger, }: DynamicWalletClientProps, internalOptions?: DynamicWalletClientInternalOptions);
|
|
6
|
+
createWalletAccount({ thresholdSignatureScheme, password, onError, signedSessionId, }: {
|
|
7
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
8
|
+
password?: string;
|
|
9
|
+
onError?: (error: Error) => void;
|
|
10
|
+
signedSessionId: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
accountAddress: string;
|
|
13
|
+
publicKeyHex: string;
|
|
14
|
+
rawPublicKey: Uint8Array;
|
|
15
|
+
}>;
|
|
16
|
+
signMessage({ message, accountAddress, password, signedSessionId, mfaToken, elevatedAccessToken, context, onError, }: {
|
|
17
|
+
message: string;
|
|
18
|
+
accountAddress: string;
|
|
19
|
+
password?: string;
|
|
20
|
+
signedSessionId: string;
|
|
21
|
+
mfaToken?: string;
|
|
22
|
+
elevatedAccessToken?: string;
|
|
23
|
+
context?: SignMessageContext;
|
|
24
|
+
onError?: (error: Error) => void;
|
|
25
|
+
}): Promise<string>;
|
|
26
|
+
signTransaction({ senderAddress, transaction, password, signedSessionId, mfaToken, elevatedAccessToken, chainId, context, onError, }: {
|
|
27
|
+
senderAddress: string;
|
|
28
|
+
/** XDR-encoded transaction envelope */
|
|
29
|
+
transaction: string;
|
|
30
|
+
password?: string;
|
|
31
|
+
signedSessionId: string;
|
|
32
|
+
mfaToken?: string;
|
|
33
|
+
elevatedAccessToken?: string;
|
|
34
|
+
chainId?: string;
|
|
35
|
+
context?: SignMessageContext;
|
|
36
|
+
onError?: (error: Error) => void;
|
|
37
|
+
}): Promise<string>;
|
|
38
|
+
exportPrivateKey({ accountAddress, password, signedSessionId, mfaToken, elevatedAccessToken, }: RequestWithElevatedAccessToken<{
|
|
39
|
+
accountAddress: string;
|
|
40
|
+
password?: string;
|
|
41
|
+
signedSessionId: string;
|
|
42
|
+
mfaToken?: string;
|
|
43
|
+
}>): Promise<string>;
|
|
44
|
+
importPrivateKey({ privateKey, chainName, thresholdSignatureScheme, password, signedSessionId, onError, publicAddressCheck, legacyWalletId, }: {
|
|
45
|
+
privateKey: string;
|
|
46
|
+
chainName: string;
|
|
47
|
+
thresholdSignatureScheme: ThresholdSignatureScheme;
|
|
48
|
+
password?: string;
|
|
49
|
+
signedSessionId: string;
|
|
50
|
+
onError?: (error: Error) => void;
|
|
51
|
+
publicAddressCheck?: string;
|
|
52
|
+
/** ID of the legacy embedded wallet being upgraded to v3 */
|
|
53
|
+
legacyWalletId?: string;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
accountAddress: string;
|
|
56
|
+
publicKeyHex: string;
|
|
57
|
+
rawPublicKey: Uint8Array;
|
|
58
|
+
clientKeyShares: ClientKeyShare[];
|
|
59
|
+
}>;
|
|
60
|
+
getPublicKeyFromPrivateKey(privateKeyHex: string): string;
|
|
61
|
+
getStellarWallets(): Promise<any>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAGnB,KAAK,cAAc,EACnB,KAAK,kCAAkC,EACvC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAcrE,qBAAa,0BAA2B,SAAQ,mBAAmB;IACjE,QAAQ,CAAC,SAAS,aAAa;gBAG7B,EACE,aAAa,EAC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,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;IAsBnD,iBAAiB;CAKxB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const ERROR_KEYGEN_FAILED = "Error with keygen";
|
|
2
|
+
export declare const ERROR_CREATE_WALLET_ACCOUNT = "Error creating stellar wallet account";
|
|
3
|
+
export declare const ERROR_IMPORT_PRIVATE_KEY = "Error importing private key";
|
|
4
|
+
export declare const ERROR_EXPORT_PRIVATE_KEY = "Error exporting private key";
|
|
5
|
+
export declare const ERROR_SIGN_MESSAGE = "Error signing message";
|
|
6
|
+
export declare const ERROR_ACCOUNT_ADDRESS_REQUIRED = "Account address is required";
|
|
7
|
+
export declare const ERROR_VERIFY_MESSAGE_SIGNATURE = "Error verifying message signature";
|
|
8
|
+
export declare const ERROR_VERIFY_TRANSACTION_SIGNATURE = "Error verifying transaction signature";
|
|
9
|
+
export declare const ERROR_SIGN_TRANSACTION = "Error signing transaction";
|
|
10
|
+
export declare const ERROR_CHAIN_ID_REQUIRED_LOCAL = "Chain ID is required";
|
|
11
|
+
export declare const STELLAR_NETWORK_PASSPHRASES: {
|
|
12
|
+
readonly MAINNET: "Public Global Stellar Network ; September 2015";
|
|
13
|
+
readonly TESTNET: "Test SDF Network ; September 2015";
|
|
14
|
+
readonly FUTURENET: "Test SDF Future Network ; October 2022";
|
|
15
|
+
};
|
|
16
|
+
/** Stellar network identifier for Horizon and display. */
|
|
17
|
+
export type StellarNetwork = keyof typeof STELLAR_NETWORK_PASSPHRASES;
|
|
18
|
+
/** Horizon API base URLs. Use when fetching account/balance so mainnet UI uses mainnet, testnet uses testnet. */
|
|
19
|
+
export declare const STELLAR_HORIZON_URLS: Record<StellarNetwork, string>;
|
|
20
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/client/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,eAAO,MAAM,2BAA2B,0CAA0C,CAAC;AAEnF,eAAO,MAAM,wBAAwB,gCAAgC,CAAC;AAEtE,eAAO,MAAM,wBAAwB,gCAAgC,CAAC;AAEtE,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,8BAA8B,gCAAgC,CAAC;AAE5E,eAAO,MAAM,8BAA8B,sCAAsC,CAAC;AAElF,eAAO,MAAM,kCAAkC,0CAA0C,CAAC;AAE1F,eAAO,MAAM,sBAAsB,8BAA8B,CAAC;AAElE,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE,eAAO,MAAM,2BAA2B;;;;CAI9B,CAAC;AAEX,0DAA0D;AAC1D,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,2BAA2B,CAAC;AAEtE,iHAAiH;AACjH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAItD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives a Stellar address (public key) from a raw Ed25519 public key
|
|
3
|
+
* Stellar addresses use StrKey encoding with version byte for public keys
|
|
4
|
+
* They start with 'G' and are 56 characters long
|
|
5
|
+
*/
|
|
6
|
+
export declare const deriveStellarAddress: ({ publicKeyHex }: {
|
|
7
|
+
publicKeyHex: string;
|
|
8
|
+
}) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Validates a Stellar address
|
|
11
|
+
* @param address The address to validate
|
|
12
|
+
* @returns true if the address is a valid Stellar public key address
|
|
13
|
+
*/
|
|
14
|
+
export declare const isValidStellarAddress: (address: string) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Decodes a Stellar address to raw Ed25519 public key bytes
|
|
17
|
+
* @param address The Stellar address (G...)
|
|
18
|
+
* @returns The raw 32-byte Ed25519 public key
|
|
19
|
+
*/
|
|
20
|
+
export declare const decodeStellarAddress: (address: string) => Buffer;
|
|
21
|
+
//# sourceMappingURL=deriveStellarAddress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deriveStellarAddress.d.ts","sourceRoot":"","sources":["../../../src/utils/deriveStellarAddress/deriveStellarAddress.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,qBAAsB;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,KAAG,MASjF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,YAAa,MAAM,KAAG,OAEvD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,MAKtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/deriveStellarAddress/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps numeric chainId (used in policies) to network passphrase (used for transaction hashing)
|
|
3
|
+
* ChainIds: '1' = pubnet (mainnet), '2' = testnet, '3' = futurenet
|
|
4
|
+
*/
|
|
5
|
+
export declare const STELLAR_CHAIN_ID_TO_PASSPHRASE: Record<string, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the network passphrase from a numeric chainId, defaults to mainnet
|
|
8
|
+
*/
|
|
9
|
+
export declare const getNetworkPassphraseFromChainId: (chainId: string) => string;
|
|
10
|
+
//# sourceMappingURL=getNetworkPassphrase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNetworkPassphrase.d.ts","sourceRoot":"","sources":["../../../src/utils/getNetworkPassphrase/getNetworkPassphrase.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,+BAA+B,YAAa,MAAM,KAAG,MAEjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/getNetworkPassphrase/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC"}
|