@dynamic-labs-wallet/sui 0.0.72 → 0.0.74
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.js +12 -11
- package/index.esm.js +12 -11
- package/package.json +2 -2
- package/src/client/client.d.ts +4 -3
- package/src/client/client.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -82,7 +82,8 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
82
82
|
return {
|
|
83
83
|
accountAddress,
|
|
84
84
|
rawPublicKey,
|
|
85
|
-
publicKeyHex
|
|
85
|
+
publicKeyHex,
|
|
86
|
+
clientKeyShares
|
|
86
87
|
};
|
|
87
88
|
} catch (error) {
|
|
88
89
|
this.logger.error(ERROR_CREATE_WALLET_ACCOUNT, error);
|
|
@@ -138,11 +139,11 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
138
139
|
throw error;
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
|
-
async verifyTransactionSignature({
|
|
142
|
+
async verifyTransactionSignature({ message, signature, accountAddress }) {
|
|
142
143
|
try {
|
|
143
|
-
const txBytes = Uint8Array.from(Buffer.from(
|
|
144
|
+
const txBytes = Uint8Array.from(Buffer.from(message, 'hex'));
|
|
144
145
|
const verifiedPublicKey = await verify.verifyTransactionSignature(txBytes, signature);
|
|
145
|
-
const isVerified = verifiedPublicKey.toSuiAddress().toLowerCase() ===
|
|
146
|
+
const isVerified = verifiedPublicKey.toSuiAddress().toLowerCase() === accountAddress.toLowerCase();
|
|
146
147
|
if (!isVerified) {
|
|
147
148
|
throw new Error(ERROR_VERIFY_TRANSACTION_SIGNATURE);
|
|
148
149
|
}
|
|
@@ -175,23 +176,23 @@ class DynamicSuiWalletClient extends browser.DynamicWalletClient {
|
|
|
175
176
|
throw error;
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
|
-
async signTransaction({
|
|
179
|
-
if (!
|
|
179
|
+
async signTransaction({ message, accountAddress, password = undefined }) {
|
|
180
|
+
if (!accountAddress) {
|
|
180
181
|
throw new Error('Account address is required');
|
|
181
182
|
}
|
|
182
183
|
try {
|
|
183
|
-
const formattedMessage = formatMessage(
|
|
184
|
+
const formattedMessage = formatMessage(message, 'TransactionData');
|
|
184
185
|
const signatureEd25519 = await this.sign({
|
|
185
186
|
message: formattedMessage,
|
|
186
|
-
accountAddress:
|
|
187
|
+
accountAddress: accountAddress,
|
|
187
188
|
chainName: this.chainName,
|
|
188
189
|
password
|
|
189
190
|
});
|
|
190
|
-
const formattedSignature = await this.formatSignature(signatureEd25519,
|
|
191
|
+
const formattedSignature = await this.formatSignature(signatureEd25519, accountAddress);
|
|
191
192
|
await this.verifyTransactionSignature({
|
|
192
|
-
|
|
193
|
+
message,
|
|
193
194
|
signature: formattedSignature,
|
|
194
|
-
|
|
195
|
+
accountAddress
|
|
195
196
|
});
|
|
196
197
|
return formattedSignature;
|
|
197
198
|
} catch (error) {
|
package/index.esm.js
CHANGED
|
@@ -80,7 +80,8 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
80
80
|
return {
|
|
81
81
|
accountAddress,
|
|
82
82
|
rawPublicKey,
|
|
83
|
-
publicKeyHex
|
|
83
|
+
publicKeyHex,
|
|
84
|
+
clientKeyShares
|
|
84
85
|
};
|
|
85
86
|
} catch (error) {
|
|
86
87
|
this.logger.error(ERROR_CREATE_WALLET_ACCOUNT, error);
|
|
@@ -136,11 +137,11 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
136
137
|
throw error;
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
|
-
async verifyTransactionSignature({
|
|
140
|
+
async verifyTransactionSignature({ message, signature, accountAddress }) {
|
|
140
141
|
try {
|
|
141
|
-
const txBytes = Uint8Array.from(Buffer.from(
|
|
142
|
+
const txBytes = Uint8Array.from(Buffer.from(message, 'hex'));
|
|
142
143
|
const verifiedPublicKey = await verifyTransactionSignature(txBytes, signature);
|
|
143
|
-
const isVerified = verifiedPublicKey.toSuiAddress().toLowerCase() ===
|
|
144
|
+
const isVerified = verifiedPublicKey.toSuiAddress().toLowerCase() === accountAddress.toLowerCase();
|
|
144
145
|
if (!isVerified) {
|
|
145
146
|
throw new Error(ERROR_VERIFY_TRANSACTION_SIGNATURE);
|
|
146
147
|
}
|
|
@@ -173,23 +174,23 @@ class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
173
174
|
throw error;
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
|
-
async signTransaction({
|
|
177
|
-
if (!
|
|
177
|
+
async signTransaction({ message, accountAddress, password = undefined }) {
|
|
178
|
+
if (!accountAddress) {
|
|
178
179
|
throw new Error('Account address is required');
|
|
179
180
|
}
|
|
180
181
|
try {
|
|
181
|
-
const formattedMessage = formatMessage(
|
|
182
|
+
const formattedMessage = formatMessage(message, 'TransactionData');
|
|
182
183
|
const signatureEd25519 = await this.sign({
|
|
183
184
|
message: formattedMessage,
|
|
184
|
-
accountAddress:
|
|
185
|
+
accountAddress: accountAddress,
|
|
185
186
|
chainName: this.chainName,
|
|
186
187
|
password
|
|
187
188
|
});
|
|
188
|
-
const formattedSignature = await this.formatSignature(signatureEd25519,
|
|
189
|
+
const formattedSignature = await this.formatSignature(signatureEd25519, accountAddress);
|
|
189
190
|
await this.verifyTransactionSignature({
|
|
190
|
-
|
|
191
|
+
message,
|
|
191
192
|
signature: formattedSignature,
|
|
192
|
-
|
|
193
|
+
accountAddress
|
|
193
194
|
});
|
|
194
195
|
return formattedSignature;
|
|
195
196
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/sui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@dynamic-labs-wallet/browser": "0.0.
|
|
6
|
+
"@dynamic-labs-wallet/browser": "0.0.74",
|
|
7
7
|
"@mysten/sui": "1.26.0",
|
|
8
8
|
"@noble/hashes": "1.7.1"
|
|
9
9
|
},
|
package/src/client/client.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
10
10
|
accountAddress: string;
|
|
11
11
|
publicKeyHex: string;
|
|
12
12
|
rawPublicKey: EcdsaPublicKey | Uint8Array | string | undefined;
|
|
13
|
+
clientKeyShares: ClientKeyShare[];
|
|
13
14
|
}>;
|
|
14
15
|
getRawPublicKeyFromClientKeyShares({ chainName, clientKeyShare, }: {
|
|
15
16
|
chainName: string;
|
|
@@ -26,9 +27,9 @@ export declare class DynamicSuiWalletClient extends DynamicWalletClient {
|
|
|
26
27
|
accountAddress: string;
|
|
27
28
|
password?: string;
|
|
28
29
|
}): Promise<string>;
|
|
29
|
-
signTransaction({
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
signTransaction({ message, accountAddress, password, }: {
|
|
31
|
+
message: string;
|
|
32
|
+
accountAddress: string;
|
|
32
33
|
password?: string;
|
|
33
34
|
}): Promise<string>;
|
|
34
35
|
deriveAccountAddress({ rawPublicKey }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EAGzB,MAAM,8BAA8B,CAAC;AAetC,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,QAAQ,CAAC,SAAS,SAAS;gBAEf,EACV,aAAa,EACb,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,KAAK,GACN,EAAE,wBAAwB;IAWrB,mBAAmB,CAAC,EACxB,wBAAwB,EACxB,QAAoB,EACpB,OAAO,GACR,EAAE;QACD,wBAAwB,EAAE,wBAAwB,CAAC;QACnD,QAAQ,CAAC,EAAE,MAAM,CAAC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