Skip to content

Commit 7021d22

Browse files
authored
Add grant permissions example message (#1434)
* add grant permissions method * lint
1 parent ee59560 commit 7021d22

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

examples/testapp/src/components/RpcMethods/RpcMethodCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export function RpcMethodCard({ format, method, params, shortcuts }) {
172172
<AccordionPanel pb={4}>
173173
<HStack spacing={2}>
174174
{shortcuts.map((shortcut) => (
175-
<HStack key={shortcut.key} spacing={1}>
175+
<VStack key={shortcut.key} spacing={1}>
176176
<Button onClick={() => submit(shortcut.data)}>{shortcut.key}</Button>
177177
{shortcut.data.message && (
178178
<Button
@@ -187,7 +187,7 @@ export function RpcMethodCard({ format, method, params, shortcuts }) {
187187
Copy
188188
</Button>
189189
)}
190-
</HStack>
190+
</VStack>
191191
))}
192192
</HStack>
193193
</AccordionPanel>

examples/testapp/src/components/RpcMethods/shortcut/signMessageShortcuts.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,41 @@ const ethSignTypedDataV4Shortcuts: (chainId: number) => ShortcutType[] = (chainI
130130
address: ADDR_TO_FILL,
131131
},
132132
},
133+
{
134+
key: 'Grant Permission',
135+
data: {
136+
message: {
137+
domain: {
138+
name: 'Spend Permission Manager',
139+
version: '1',
140+
chainId,
141+
verifyingContract: '0x4ba47ee994d7fd63e8e8029431c35afa8487b8a5',
142+
},
143+
types: {
144+
SpendPermission: [
145+
{ name: 'account', type: 'address' },
146+
{ name: 'spender', type: 'address' },
147+
{ name: 'token', type: 'address' },
148+
{ name: 'start', type: 'uint48' },
149+
{ name: 'end', type: 'uint48' },
150+
{ name: 'period', type: 'uint48' },
151+
{ name: 'allowance', type: 'uint160' },
152+
],
153+
},
154+
primaryType: 'SpendPermission',
155+
message: {
156+
account: '0xd4e17478581878A967aA22d45a5158A9fE96AA08',
157+
spender: '0x0000000000000000000000000000000000000000',
158+
token: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
159+
end: 17242884802,
160+
start: 1724264802,
161+
period: 86400,
162+
allowance: '10000000000000000',
163+
},
164+
},
165+
address: ADDR_TO_FILL,
166+
},
167+
},
133168
];
134169

135170
export const signMessageShortcutsMap = (chainId: number) => ({

0 commit comments

Comments
 (0)