Skip to content

Commit 39baa52

Browse files
committed
feat: adds @aave/client/viem and @aave/client/ethers entry points
1 parent 755bd25 commit 39baa52

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

packages/client/src/errors.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import type { TypedSelectionSet } from '@aave/graphql';
12
import { ResultAwareError } from '@aave/types';
23
import type { CombinedError } from '@urql/core';
3-
import type { ErrorResponse } from './types';
44

55
/**
66
* @internal
@@ -57,17 +57,17 @@ export class TransactionIndexingError extends ResultAwareError {
5757
* See the `cause` property for more information.
5858
*/
5959
export class ValidationError<
60-
T extends string = string,
60+
TGqlNode extends TypedSelectionSet,
6161
> extends ResultAwareError {
6262
name = 'ValidationError' as const;
6363

64-
constructor(public readonly cause: ErrorResponse<T>) {
65-
super(cause.reason);
64+
constructor(public readonly cause: TGqlNode) {
65+
super(cause.__typename);
6666
}
6767

68-
static fromErrorResponse<T extends string>(
69-
error: ErrorResponse<T>,
70-
): ValidationError<T> {
68+
static fromGqlNode<TGqlNode extends TypedSelectionSet>(
69+
error: TGqlNode,
70+
): ValidationError<TGqlNode> {
7171
return new ValidationError(error);
7272
}
7373
}

packages/client/src/ethers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

packages/client/src/types.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
export type ErrorResponse<T extends string> = {
2-
__typename: T;
3-
reason: string;
4-
};
1+
import type { Transaction, TransactionRequest } from '@aave/graphql';
2+
import type { ResultAsync, TxHash } from '@aave/types';
3+
import type { SigningError } from '../dist';
4+
import type { ValidationError } from './errors';
5+
6+
export type OperationHandler<T extends Transaction = Transaction> = (
7+
result: T,
8+
) => ResultAsync<
9+
TxHash,
10+
SigningError | ValidationError<Exclude<T, TransactionRequest>>
11+
>;

packages/client/src/viem.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

packages/client/tsup.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
import { defineConfig } from 'tsup';
33

44
export default defineConfig(() => ({
5-
entry: ['src/index.ts', 'src/actions/index.ts', 'src/test-utils.ts'],
5+
entry: [
6+
'src/index.ts',
7+
'src/actions/index.ts',
8+
'src/ethers.ts',
9+
'src/viem.ts',
10+
'src/test-utils.ts',
11+
],
612
outDir: 'dist',
713
splitting: false,
814
sourcemap: true,

0 commit comments

Comments
 (0)