@dfns/lib-viem 0.7.3-rc → 0.7.4
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.js +3 -1
- package/package.json +8 -2
package/index.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DfnsWallet = void 0;
|
|
4
4
|
const sdk_1 = require("@dfns/sdk");
|
|
5
|
+
const secp256k1_1 = require("@noble/curves/secp256k1");
|
|
5
6
|
const viem_1 = require("viem");
|
|
6
7
|
const accounts_1 = require("viem/accounts");
|
|
8
|
+
const uncompressPublicKey = (compressed) => `0x${Buffer.from(secp256k1_1.secp256k1.Point.fromHex(compressed).toBytes(false)).toString('hex')}`;
|
|
7
9
|
const assertSigned = (res) => {
|
|
8
10
|
if (res.status === 'Failed') {
|
|
9
11
|
throw new sdk_1.DfnsError(-1, 'signing failed', res);
|
|
@@ -32,7 +34,7 @@ class DfnsWallet {
|
|
|
32
34
|
this.metadata = metadata;
|
|
33
35
|
this.address = this.metadata.boundToEvmNetwork
|
|
34
36
|
? (0, viem_1.getAddress)(this.metadata.address)
|
|
35
|
-
: (0, accounts_1.publicKeyToAddress)((
|
|
37
|
+
: (0, accounts_1.publicKeyToAddress)(uncompressPublicKey(this.metadata.signingKey.publicKey));
|
|
36
38
|
this.dfnsClient = options.dfnsClient;
|
|
37
39
|
// must scope these three functions. otherwise the `LocalAccount` returned with
|
|
38
40
|
// `toAccount` will not be able to resolve `this` when calling sign functions
|
package/package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfns/lib-viem",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"
|
|
5
|
+
"@noble/curves": "^1.0.0",
|
|
6
|
+
"viem": "^2.0.0",
|
|
7
|
+
"@dfns/sdk": "0.7.4"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"buffer": "6.0.3",
|
|
11
|
+
"cross-fetch": "3.1.6"
|
|
6
12
|
},
|
|
7
13
|
"main": "./index.js",
|
|
8
14
|
"type": "commonjs"
|