@dfns/lib-viem 0.6.4-alpha.1 → 0.6.5
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.d.ts +0 -4
- package/index.js +0 -14
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { DfnsApiClient } from '@dfns/sdk';
|
|
2
2
|
import { Address, GetTransactionType, Hash, SerializeTransactionFn, SignableMessage, TransactionSerializable, TransactionSerialized, TypedData, TypedDataDefinition } from 'viem';
|
|
3
3
|
import { IsNarrowable } from 'viem/_types/types/utils';
|
|
4
|
-
import { SignAuthorizationParameters, SignAuthorizationReturnType } from 'viem/accounts';
|
|
5
|
-
type To = 'object' | 'bytes' | 'hex';
|
|
6
4
|
export type DfnsWalletOptions = {
|
|
7
5
|
walletId: string;
|
|
8
6
|
dfnsClient: DfnsApiClient;
|
|
@@ -25,6 +23,4 @@ export declare class DfnsWallet {
|
|
|
25
23
|
serializer?: serializer | undefined;
|
|
26
24
|
} | undefined): Promise<IsNarrowable<TransactionSerialized<GetTransactionType<transaction>>, Hash> extends true ? TransactionSerialized<GetTransactionType<transaction>> : Hash>;
|
|
27
25
|
signTypedData<const typedData extends TypedData | Record<string, unknown>, primaryType extends keyof typedData | 'EIP712Domain' = keyof typedData>(typedDataDefinition: TypedDataDefinition<typedData, primaryType>): Promise<Hash>;
|
|
28
|
-
experimental_signAuthorization<to extends To = 'object'>(parameters: SignAuthorizationParameters<to>): Promise<SignAuthorizationReturnType<to>>;
|
|
29
26
|
}
|
|
30
|
-
export {};
|
package/index.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.DfnsWallet = void 0;
|
|
|
4
4
|
const sdk_1 = require("@dfns/sdk");
|
|
5
5
|
const viem_1 = require("viem");
|
|
6
6
|
const accounts_1 = require("viem/accounts");
|
|
7
|
-
const experimental_1 = require("viem/experimental");
|
|
8
7
|
const assertSigned = (res) => {
|
|
9
8
|
if (res.status === 'Failed') {
|
|
10
9
|
throw new sdk_1.DfnsError(-1, 'signing failed', res);
|
|
@@ -40,7 +39,6 @@ class DfnsWallet {
|
|
|
40
39
|
this.signMessage = this.signMessage.bind(this);
|
|
41
40
|
this.signTransaction = this.signTransaction.bind(this);
|
|
42
41
|
this.signTypedData = this.signTypedData.bind(this);
|
|
43
|
-
this.experimental_signAuthorization = this.experimental_signAuthorization.bind(this);
|
|
44
42
|
}
|
|
45
43
|
static async init(options) {
|
|
46
44
|
const { walletId, dfnsClient } = options;
|
|
@@ -108,17 +106,5 @@ class DfnsWallet {
|
|
|
108
106
|
const signature = await this.signHash(hash);
|
|
109
107
|
return (0, viem_1.signatureToHex)(signature);
|
|
110
108
|
}
|
|
111
|
-
async experimental_signAuthorization(parameters) {
|
|
112
|
-
const { contractAddress, chainId, nonce, to = 'object', } = parameters;
|
|
113
|
-
const signature = await this.signHash((0, experimental_1.hashAuthorization)({ contractAddress, chainId, nonce }));
|
|
114
|
-
if (to === 'object')
|
|
115
|
-
return {
|
|
116
|
-
contractAddress,
|
|
117
|
-
chainId,
|
|
118
|
-
nonce,
|
|
119
|
-
...signature,
|
|
120
|
-
};
|
|
121
|
-
return signature;
|
|
122
|
-
}
|
|
123
109
|
}
|
|
124
110
|
exports.DfnsWallet = DfnsWallet;
|
package/package.json
CHANGED