@dynamic-labs-wallet/node-svm 1.1.14 → 1.1.15
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/index.cjs +9 -6
- package/index.esm.js +9 -6
- package/package.json +2 -2
- package/src/delegatedClient.d.ts +6 -3
- package/src/delegatedClient.d.ts.map +1 -1
package/index.cjs
CHANGED
|
@@ -598,7 +598,7 @@ const logError = node.createLogError('node-svm');
|
|
|
598
598
|
};
|
|
599
599
|
/**
|
|
600
600
|
* Signs a message using delegated signing for SVM
|
|
601
|
-
*/ const delegatedSignMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, isFormatted = false, context })=>{
|
|
601
|
+
*/ const delegatedSignMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, isFormatted = false, context, onError })=>{
|
|
602
602
|
try {
|
|
603
603
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
604
604
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a message');
|
|
@@ -615,7 +615,8 @@ const logError = node.createLogError('node-svm');
|
|
|
615
615
|
chainName: client.chainName,
|
|
616
616
|
derivationPath,
|
|
617
617
|
isFormatted,
|
|
618
|
-
context: resolvedContext
|
|
618
|
+
context: resolvedContext,
|
|
619
|
+
onError
|
|
619
620
|
});
|
|
620
621
|
return encodeBase58(signatureEd25519);
|
|
621
622
|
} catch (error) {
|
|
@@ -766,7 +767,7 @@ const toSignerPublicKey = (resolvedSignerAddress)=>{
|
|
|
766
767
|
throw new Error(`Invalid signer address: ${resolvedSignerAddress}. ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
767
768
|
}
|
|
768
769
|
};
|
|
769
|
-
const delegatedSignTransaction = async (client, { walletId, shareSetId, walletApiKey, keyShare, transaction, signerAddress, derivationPath, chainId, context, sponsor = false, userId, traceContext })=>{
|
|
770
|
+
const delegatedSignTransaction = async (client, { walletId, shareSetId, walletApiKey, keyShare, transaction, signerAddress, derivationPath, chainId, context, sponsor = false, userId, traceContext, onError })=>{
|
|
770
771
|
try {
|
|
771
772
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
772
773
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a transaction');
|
|
@@ -790,7 +791,8 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
|
|
|
790
791
|
chainName: client.chainName,
|
|
791
792
|
derivationPath,
|
|
792
793
|
isFormatted: false,
|
|
793
|
-
context: resolvedContext
|
|
794
|
+
context: resolvedContext,
|
|
795
|
+
onError
|
|
794
796
|
});
|
|
795
797
|
if (!signatureEd25519) {
|
|
796
798
|
throw new Error('Signature is undefined');
|
|
@@ -844,7 +846,7 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
|
|
|
844
846
|
* rawSign: { hashFunction: SignMessageRawSignHashFunctionEnum.Sha256, payload },
|
|
845
847
|
* });
|
|
846
848
|
*
|
|
847
|
-
*/ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, rawSign })=>{
|
|
849
|
+
*/ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, rawSign, onError })=>{
|
|
848
850
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
849
851
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a raw message');
|
|
850
852
|
}
|
|
@@ -858,7 +860,8 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
|
|
|
858
860
|
message: node.stripHexPrefix(message),
|
|
859
861
|
derivationPath,
|
|
860
862
|
isFormatted: true,
|
|
861
|
-
context: resolvedContext
|
|
863
|
+
context: resolvedContext,
|
|
864
|
+
onError
|
|
862
865
|
});
|
|
863
866
|
} catch (error) {
|
|
864
867
|
logError({
|
package/index.esm.js
CHANGED
|
@@ -596,7 +596,7 @@ const logError = createLogError('node-svm');
|
|
|
596
596
|
};
|
|
597
597
|
/**
|
|
598
598
|
* Signs a message using delegated signing for SVM
|
|
599
|
-
*/ const delegatedSignMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, isFormatted = false, context })=>{
|
|
599
|
+
*/ const delegatedSignMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, isFormatted = false, context, onError })=>{
|
|
600
600
|
try {
|
|
601
601
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
602
602
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a message');
|
|
@@ -613,7 +613,8 @@ const logError = createLogError('node-svm');
|
|
|
613
613
|
chainName: client.chainName,
|
|
614
614
|
derivationPath,
|
|
615
615
|
isFormatted,
|
|
616
|
-
context: resolvedContext
|
|
616
|
+
context: resolvedContext,
|
|
617
|
+
onError
|
|
617
618
|
});
|
|
618
619
|
return encodeBase58(signatureEd25519);
|
|
619
620
|
} catch (error) {
|
|
@@ -764,7 +765,7 @@ const toSignerPublicKey = (resolvedSignerAddress)=>{
|
|
|
764
765
|
throw new Error(`Invalid signer address: ${resolvedSignerAddress}. ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
765
766
|
}
|
|
766
767
|
};
|
|
767
|
-
const delegatedSignTransaction = async (client, { walletId, shareSetId, walletApiKey, keyShare, transaction, signerAddress, derivationPath, chainId, context, sponsor = false, userId, traceContext })=>{
|
|
768
|
+
const delegatedSignTransaction = async (client, { walletId, shareSetId, walletApiKey, keyShare, transaction, signerAddress, derivationPath, chainId, context, sponsor = false, userId, traceContext, onError })=>{
|
|
768
769
|
try {
|
|
769
770
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
770
771
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a transaction');
|
|
@@ -788,7 +789,8 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
|
|
|
788
789
|
chainName: client.chainName,
|
|
789
790
|
derivationPath,
|
|
790
791
|
isFormatted: false,
|
|
791
|
-
context: resolvedContext
|
|
792
|
+
context: resolvedContext,
|
|
793
|
+
onError
|
|
792
794
|
});
|
|
793
795
|
if (!signatureEd25519) {
|
|
794
796
|
throw new Error('Signature is undefined');
|
|
@@ -842,7 +844,7 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
|
|
|
842
844
|
* rawSign: { hashFunction: SignMessageRawSignHashFunctionEnum.Sha256, payload },
|
|
843
845
|
* });
|
|
844
846
|
*
|
|
845
|
-
*/ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, rawSign })=>{
|
|
847
|
+
*/ const delegatedSignRawMessage = async (client, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, rawSign, onError })=>{
|
|
846
848
|
if (!keyShare || !walletId || !walletApiKey) {
|
|
847
849
|
throw new Error('Delegated key share, wallet ID, and wallet API key are required to sign a raw message');
|
|
848
850
|
}
|
|
@@ -856,7 +858,8 @@ const delegatedSignTransaction = async (client, { walletId, shareSetId, walletAp
|
|
|
856
858
|
message: stripHexPrefix(message),
|
|
857
859
|
derivationPath,
|
|
858
860
|
isFormatted: true,
|
|
859
|
-
context: resolvedContext
|
|
861
|
+
context: resolvedContext,
|
|
862
|
+
onError
|
|
860
863
|
});
|
|
861
864
|
} catch (error) {
|
|
862
865
|
logError({
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node-svm",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/node": "1.1.
|
|
7
|
+
"@dynamic-labs-wallet/node": "1.1.15",
|
|
8
8
|
"@solana/web3.js": "^1.98.2"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
package/src/delegatedClient.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const createDelegatedSvmWalletClient: ({ environmentId, baseApiUr
|
|
|
19
19
|
/**
|
|
20
20
|
* Signs a message using delegated signing for SVM
|
|
21
21
|
*/
|
|
22
|
-
export declare const delegatedSignMessage: (client: DelegatedSvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, isFormatted, context, }: {
|
|
22
|
+
export declare const delegatedSignMessage: (client: DelegatedSvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, isFormatted, context, onError, }: {
|
|
23
23
|
walletId: string;
|
|
24
24
|
/**
|
|
25
25
|
* Optional. The `shareSetId` from the `wallet.delegation.created`
|
|
@@ -35,6 +35,7 @@ export declare const delegatedSignMessage: (client: DelegatedSvmWalletClient, {
|
|
|
35
35
|
derivationPath?: Uint32Array;
|
|
36
36
|
isFormatted?: boolean;
|
|
37
37
|
context?: SignMessageContext;
|
|
38
|
+
onError?: (error: Error) => void;
|
|
38
39
|
}) => Promise<string>;
|
|
39
40
|
export declare const delegatedSponsorTransaction: (client: DelegatedSvmWalletClient, { transaction, userId, traceContext, }: {
|
|
40
41
|
transaction: VersionedTransaction | Transaction;
|
|
@@ -42,7 +43,7 @@ export declare const delegatedSponsorTransaction: (client: DelegatedSvmWalletCli
|
|
|
42
43
|
traceContext?: TraceContext;
|
|
43
44
|
}) => Promise<VersionedTransaction>;
|
|
44
45
|
export declare const ERROR_DELEGATED_SIGN_TRANSACTION_CONTEXT_REQUIRED = "SVM transaction signing requires a chainId or an explicit context.svmTransaction.";
|
|
45
|
-
export declare const delegatedSignTransaction: (client: DelegatedSvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, transaction, signerAddress, derivationPath, chainId, context, sponsor, userId, traceContext, }: {
|
|
46
|
+
export declare const delegatedSignTransaction: (client: DelegatedSvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, transaction, signerAddress, derivationPath, chainId, context, sponsor, userId, traceContext, onError, }: {
|
|
46
47
|
walletId: string;
|
|
47
48
|
/**
|
|
48
49
|
* Optional. The `shareSetId` from the `wallet.delegation.created`
|
|
@@ -64,6 +65,7 @@ export declare const delegatedSignTransaction: (client: DelegatedSvmWalletClient
|
|
|
64
65
|
/** Required when `sponsor` is true. UUID of the wallet's owner. */
|
|
65
66
|
userId?: string;
|
|
66
67
|
traceContext?: TraceContext;
|
|
68
|
+
onError?: (error: Error) => void;
|
|
67
69
|
}) => Promise<VersionedTransaction | Transaction>;
|
|
68
70
|
/**
|
|
69
71
|
* Signs a pre-formatted (raw) message using delegated signing for SVM.
|
|
@@ -94,7 +96,7 @@ export declare const delegatedSignTransaction: (client: DelegatedSvmWalletClient
|
|
|
94
96
|
* });
|
|
95
97
|
*
|
|
96
98
|
*/
|
|
97
|
-
export declare const delegatedSignRawMessage: (client: DelegatedSvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, rawSign, }: {
|
|
99
|
+
export declare const delegatedSignRawMessage: (client: DelegatedSvmWalletClient, { walletId, shareSetId, walletApiKey, keyShare, message, derivationPath, context, rawSign, onError, }: {
|
|
98
100
|
walletId: string;
|
|
99
101
|
/**
|
|
100
102
|
* Optional. The `shareSetId` from the `wallet.delegation.created`
|
|
@@ -110,6 +112,7 @@ export declare const delegatedSignRawMessage: (client: DelegatedSvmWalletClient,
|
|
|
110
112
|
derivationPath?: Uint32Array;
|
|
111
113
|
context?: SignMessageContext;
|
|
112
114
|
rawSign?: RawSignPreImage;
|
|
115
|
+
onError?: (error: Error) => void;
|
|
113
116
|
}) => Promise<string>;
|
|
114
117
|
/**
|
|
115
118
|
* Revoke delegation - delegates to the node package
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegatedClient.d.ts","sourceRoot":"","sources":["../../packages/src/delegatedClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAUtH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MA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