Skip to content
This repository was archived by the owner on Feb 8, 2025. It is now read-only.

Commit 06c1a9b

Browse files
committed
refactor(api,app): rename Transferlike isFeeTransfer -> fee
1 parent 53541c8 commit 06c1a9b

14 files changed

+28
-20
lines changed

api/dbschema/edgeql-js/__spec__.ts

+1-1
Large diffs are not rendered by default.

api/dbschema/edgeql-js/modules/default.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -705,10 +705,10 @@ export type $TransferlikeλShape = $.typeutil.flatten<$EventλShape & {
705705
"amount": $.PropertyDesc<_std.$decimal, $.Cardinality.One, false, false, false, false>;
706706
"from": $.PropertyDesc<$Address, $.Cardinality.One, false, false, false, false>;
707707
"incoming": $.PropertyDesc<_std.$bool, $.Cardinality.One, false, false, false, false>;
708-
"isFeeTransfer": $.PropertyDesc<_std.$bool, $.Cardinality.One, false, false, false, true>;
709708
"outgoing": $.PropertyDesc<_std.$bool, $.Cardinality.One, false, false, false, false>;
710709
"to": $.PropertyDesc<$Address, $.Cardinality.One, false, false, false, false>;
711710
"spentBy": $.LinkDesc<$Policy, $.Cardinality.AtMostOne, {}, false, false, false, false>;
711+
"fee": $.PropertyDesc<_std.$bool, $.Cardinality.One, false, false, false, true>;
712712
}>;
713713
type $Transferlike = $.ObjectType<"default::Transferlike", $TransferlikeλShape, null, [
714714
...$Event['__exclusives__'],

api/dbschema/events.esdl

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module default {
3232
required amount: decimal;
3333
required incoming: bool;
3434
required outgoing: bool;
35-
required isFeeTransfer: bool { default := false; }
35+
required fee: bool { default := false; }
3636
spentBy: Policy { rewrite insert, update using (__subject__.result.transaction.policy) }
3737

3838
access policy members_can_select_insert

api/dbschema/interfaces.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,10 @@ export namespace $default {
291291
"amount": string;
292292
"from": string;
293293
"incoming": boolean;
294-
"isFeeTransfer": boolean;
295294
"outgoing": boolean;
296295
"to": string;
297296
"spentBy"?: Policy | null;
297+
"fee": boolean;
298298
}
299299
export interface Transfer extends Transferlike {}
300300
export interface TransferApproval extends Transferlike {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CREATE MIGRATION m15qj3htiny7zuqceuvj46wrm7yza5xyqmfuadsywsbc6tvh6vb34a
2+
ONTO m13y2dtmcrd7yvmorrgn62mp2cakpvrcbz7p7g2rr4wk34b6ow7m7q
3+
{
4+
ALTER TYPE default::Transferlike {
5+
ALTER PROPERTY isFeeTransfer {
6+
RENAME TO fee;
7+
};
8+
};
9+
};

api/schema.graphql

+3-3
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,11 @@ type Transfer implements Event & Node & Transferlike {
922922
amount: Decimal!
923923
block: BigInt!
924924
confirmed: Boolean!
925+
fee: Boolean!
925926
from: Address!
926927
id: ID!
927928
incoming: Boolean!
928929
internal: Boolean!
929-
isFeeTransfer: Boolean!
930930
logIndex: Float!
931931
outgoing: Boolean!
932932
result: Result
@@ -945,11 +945,11 @@ type TransferApproval implements Event & Node & Transferlike {
945945
block: BigInt!
946946
confirmed: Boolean!
947947
delta: Decimal!
948+
fee: Boolean!
948949
from: Address!
949950
id: ID!
950951
incoming: Boolean!
951952
internal: Boolean!
952-
isFeeTransfer: Boolean!
953953
logIndex: Float!
954954
outgoing: Boolean!
955955
result: Result
@@ -1012,11 +1012,11 @@ interface Transferlike implements Event & Node {
10121012
amount: Decimal!
10131013
block: BigInt!
10141014
confirmed: Boolean!
1015+
fee: Boolean!
10151016
from: Address!
10161017
id: ID!
10171018
incoming: Boolean!
10181019
internal: Boolean!
1019-
isFeeTransfer: Boolean!
10201020
logIndex: Float!
10211021
outgoing: Boolean!
10221022
result: Result

api/src/feat/transfers/insert-transfer-approval.edgeql

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ with accountAddress := <UAddress>$account,
2020
amount := <decimal>$amount,
2121
incoming := (to = localAccount),
2222
outgoing := (from = localAccount),
23-
isFeeTransfer := ((result.transaction.paymaster in {from, to}) ?? false)
23+
fee := ((result.transaction.paymaster in {from, to}) ?? false)
2424
} unless conflict
2525
)
2626
select transfer;

api/src/feat/transfers/insert-transfer-approval.query.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ with accountAddress := <UAddress>$account,
4343
amount := <decimal>$amount,
4444
incoming := (to = localAccount),
4545
outgoing := (from = localAccount),
46-
isFeeTransfer := ((result.transaction.paymaster in {from, to}) ?? false)
46+
fee := ((result.transaction.paymaster in {from, to}) ?? false)
4747
} unless conflict
4848
)
4949
select transfer;`, args);

api/src/feat/transfers/insert-transfer.edgeql

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ with accountAddress := <UAddress>$account,
2020
amount := <decimal>$amount,
2121
incoming := (to = localAccount),
2222
outgoing := (from = localAccount),
23-
isFeeTransfer := ((result.transaction.paymaster in {from, to}) ?? false)
23+
fee := ((result.transaction.paymaster in {from, to}) ?? false)
2424
} unless conflict
2525
)
2626
select transfer {
2727
id,
2828
internal,
29-
isFeeTransfer,
3029
accountUsers := .account.approvers.user.id
3130
}

api/src/feat/transfers/insert-transfer.query.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type InsertTransferArgs = {
1818
export type InsertTransferReturns = {
1919
"id": string;
2020
"internal": boolean;
21-
"isFeeTransfer": boolean;
21+
"fee": boolean;
2222
"accountUsers": Array<string>;
2323
} | null;
2424

@@ -46,13 +46,13 @@ with accountAddress := <UAddress>$account,
4646
amount := <decimal>$amount,
4747
incoming := (to = localAccount),
4848
outgoing := (from = localAccount),
49-
isFeeTransfer := ((result.transaction.paymaster in {from, to}) ?? false)
49+
fee := ((result.transaction.paymaster in {from, to}) ?? false)
5050
} unless conflict
5151
)
5252
select transfer {
5353
id,
5454
internal,
55-
isFeeTransfer,
55+
fee,
5656
accountUsers := .account.approvers.user.id
5757
}`, args);
5858

api/src/feat/transfers/transfers.events.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class TransfersEvents {
9696
(payload) => payload.transfer,
9797
);
9898

99-
if (!event.result && !transfer.isFeeTransfer) {
99+
if (!event.result && !transfer.fee) {
100100
this.log.debug(
101101
`[${account}]: token (${token}) transfer ${
102102
from === account ? `to ${to}` : `from ${from}`

api/src/feat/transfers/transfers.model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class Transferlike extends Node {
3434
outgoing: boolean;
3535

3636
@Field(() => Boolean)
37-
isFeeTransfer: boolean;
37+
fee: boolean;
3838

3939
@Field(() => Policy, { nullable: true })
4040
spentBy?: Policy;

app/src/components/transaction/TransactionTransfers.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const Transaction = graphql`
2828
amount
2929
from
3030
to
31-
isFeeTransfer
31+
fee
3232
}
3333
}
3434
...TransactionValue_transaction
@@ -43,7 +43,7 @@ export function TransactionTransfers(props: TransactionTransfersProps) {
4343
const { styles } = useStyles(stylesheet);
4444
const t = useFragment(Transaction, props.transaction);
4545

46-
const transfers = t.result?.transfers?.filter((t) => !t.isFeeTransfer);
46+
const transfers = t.result?.transfers?.filter((t) => !t.fee);
4747

4848
if (!transfers?.length) return null;
4949

app/src/components/transaction/TransactionValue.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Transaction = graphql`
1212
transfers {
1313
id
1414
value
15-
isFeeTransfer
15+
fee
1616
}
1717
}
1818
}
@@ -26,7 +26,7 @@ export interface TransactionValueProps {
2626
export function TransactionValue(props: TransactionValueProps) {
2727
const p = useFragment(Transaction, props.transaction);
2828

29-
const transfers = (p.result?.transfers ?? []).filter((t) => !t.isFeeTransfer);
29+
const transfers = (p.result?.transfers ?? []).filter((t) => !t.fee);
3030

3131
const value = Decimal.sum(0, ...transfers.map((t) => t.value ?? 0));
3232

0 commit comments

Comments
 (0)