Skip to content

Commit 58c3c37

Browse files
AyushBherwani1998Ayush Bherwanialexandratran
authored
v0.13 changes
* v0.13 changes * Apply suggestions from code review Co-authored-by: Alexandra Carrillo <[email protected]> --------- Co-authored-by: Ayush Bherwani <“[email protected]”> Co-authored-by: Alexandra Carrillo <[email protected]>
1 parent f6cb791 commit 58c3c37

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

delegation-toolkit/guides/delegation/use-delegation-scopes/constrain-scope.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,24 @@ You can further constrain these scopes and limit the delegation's authority by a
2222
## Apply a caveat enforcer
2323

2424
For example, Alice creates a delegation with an [ERC-20 transfer scope](spending-limit.md#erc-20-transfer-scope) that allows Bob to spend up to 10 USDC.
25-
If Alice wants to further constrain the scope so that Bob can use the delegation only once,
26-
she can apply the [`limitedCalls`](../../../reference/delegation/caveats.md#limitedcalls) caveat enforcer.
25+
If Alice wants to further restrict the scope to limit Bob's delegation to be valid for only seven days,
26+
she can apply the [`timestamp`](../../../reference/delegation/caveats.md#timestamp) caveat enforcer.
2727

28-
The following example creates a delegation using [`createDelegation`](../../../reference/delegation/index.md#createdelegation), applies the ERC-20 transfer scope with a spending limit of 10 USDC, and applies the `limitedCalls` caveat enforcer to constrain the delegation to a one-time use:
28+
The following example creates a delegation using [`createDelegation`](../../../reference/delegation/index.md#createdelegation), applies the ERC-20 transfer scope with a spending limit of 10 USDC, and applies the `timestamp` caveat enforcer to restrict the delegation's validity to a seven-day period:
2929

3030
```typescript
3131
import { createDelegation } from "@metamask/delegation-toolkit";
3232

33-
// Constrains the delegation to one-time use.
33+
// Convert milliseconds to seconds.
34+
const currentTime = Math.floor(Date.now() / 1000);
35+
36+
// Seven days after current time.
37+
const beforeThreshold = currentTime + 604800;
38+
3439
const caveats = [{
35-
type: "limitedCalls",
36-
limit: 1,
40+
type: "timestamp",
41+
afterThreshold: currentTime,
42+
beforeThreshold,
3743
}];
3844

3945
const delegation = createDelegation({

gator-sidebar.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22

33
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
4+
45
const sidebar = {
56
gatorSidebar: [
67
{
@@ -23,7 +24,7 @@ const sidebar = {
2324
'get-started/smart-account-quickstart/eip7702',
2425
],
2526
},
26-
'get-started/erc7715-quickstart',
27+
// 'get-started/erc7715-quickstart',
2728
'get-started/use-the-cli',
2829
'get-started/supported-networks',
2930
],
@@ -87,15 +88,15 @@ const sidebar = {
8788
},
8889
],
8990
},
90-
{
91-
type: 'category',
92-
label: 'Experimental',
93-
collapsed: false,
94-
items: [
95-
'experimental/erc-7715-request-permissions',
96-
'experimental/erc-7710-redeem-delegations',
97-
],
98-
},
91+
// {
92+
// type: 'category',
93+
// label: 'Experimental',
94+
// collapsed: false,
95+
// items: [
96+
// 'experimental/erc-7715-request-permissions',
97+
// 'experimental/erc-7710-redeem-delegations',
98+
// ],
99+
// },
99100
{
100101
type: 'category',
101102
label: 'Tutorials',
@@ -140,15 +141,15 @@ const sidebar = {
140141
'reference/delegation/caveat-enforcer-client',
141142
],
142143
},
143-
{
144-
type: 'category',
145-
label: 'ERC-7715',
146-
collapsed: false,
147-
items: [
148-
'reference/erc7715/wallet-client',
149-
'reference/erc7715/bundler-client',
150-
],
151-
},
144+
// {
145+
// type: 'category',
146+
// label: 'ERC-7715',
147+
// collapsed: false,
148+
// items: [
149+
// 'reference/erc7715/wallet-client',
150+
// 'reference/erc7715/bundler-client',
151+
// ],
152+
// },
152153
],
153154
},
154155
],

src/pages/tutorials/create-invite-link.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const smartAccount = await toMetaMaskSmartAccount({
147147
implementation: Implementation.Hybrid,
148148
deployParams: [address, [], [], []],
149149
deploySalt: '0x',
150-
signatory: { walletClient },
150+
signer: { walletClient },
151151
});
152152
```
153153

0 commit comments

Comments
 (0)