Skip to content

Commit 36a596e

Browse files
authored
intents: add support for child wallet adoption and intent confirmation (#176)
* intents: add support for child wallet adoption & intent confirmation * generated files * correct JSON "Id" casing
1 parent 6287e6d commit 36a596e

File tree

6 files changed

+377
-602
lines changed

6 files changed

+377
-602
lines changed

go.work.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
259259
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
260260
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
261261
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
262+
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
262263
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
263264
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
264265
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -402,6 +403,7 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
402403
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
403404
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
404405
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
406+
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
405407
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
406408
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
407409
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=

intents/intent.gen.go

Lines changed: 96 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

intents/intent.ridl

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ enum IntentName: string
3434
- removeAccount
3535
- listAccounts
3636
- getIdToken
37+
- adoptChildWallet
38+
- getAdopter
39+
- confirmIntent
40+
- getConfirmationStatus
3741

3842
struct IntentDataInitiateAuth
3943
- sessionId: string
@@ -141,13 +145,37 @@ struct IntentDataRemoveAccount
141145
- accountId: string
142146
+ go.field.name = AccountID
143147

148+
struct IntentDataAdoptChildWallet
149+
- network: string
150+
- wallet: string
151+
- adopter: string
152+
- adopterProof: AdopterProof
153+
154+
struct AdopterProof
155+
- message: string
156+
- signature: string
157+
144158
struct IntentDataGetIdToken
145159
- sessionId: string
146160
+ go.field.name = SessionID
147161
- wallet: string
148162
- nonce?: string
149163
+ go.field.type = string
150164

165+
struct IntentDataGetAdopter
166+
- wallet: string
167+
168+
struct IntentDataConfirmIntent
169+
- wallet: string
170+
- confirmationID: string
171+
+ go.field.name = ConfirmationID
172+
- challengeAnswer: string
173+
174+
struct IntentDataGetConfirmationStatus
175+
- wallet: string
176+
- confirmationID: string
177+
+ go.field.name = ConfirmationID
178+
151179
struct TransactionRaw
152180
- type: string
153181
- to: string
@@ -159,7 +187,7 @@ struct AbiData
159187
- abi: string
160188
- func?: string
161189
- args: []any
162-
190+
163191
enum TransactionType: string
164192
- transaction
165193
- erc20send
@@ -232,6 +260,9 @@ enum IntentResponseCode: string
232260
- accountFederated
233261
- accountRemoved
234262
- idToken
263+
- adopter
264+
- childWalletAdopted
265+
- confirmationRequired
235266

236267
struct IntentResponseAuthInitiated
237268
- sessionId: string
@@ -334,6 +365,20 @@ struct IntentResponseIdToken
334365
- idToken: string
335366
- expiresIn: int
336367

368+
struct IntentResponseChildWalletAdopted
369+
- adopterAddress: string
370+
371+
struct IntentResponseAdopter
372+
- adopterAddress: string
373+
374+
struct IntentResponseConfirmationRequired
375+
- confirmationId: string
376+
+ go.field.name = ConfirmationID
377+
- salt: string
378+
- challengeType: ChallengeType
379+
- challengeDestination?: string
380+
- expiresIn: int
381+
337382
enum IdentityType: string
338383
- None
339384
- Guest
@@ -351,3 +396,6 @@ struct Account
351396
+ go.tag.json = issuer,omitempty
352397
- email?: string
353398
+ go.tag.json = email,omitempty
399+
400+
enum ChallengeType: string
401+
- EmailOTP

intents/intent_response_typed.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ func IntentResponseTypeToCode[T any](t *T) IntentResponseCode {
3636
return IntentResponseCode_accountFederated
3737
case *IntentResponseAccountRemoved:
3838
return IntentResponseCode_accountRemoved
39+
case *IntentResponseChildWalletAdopted:
40+
return IntentResponseCode_childWalletAdopted
41+
case *IntentResponseAdopter:
42+
return IntentResponseCode_adopter
43+
case *IntentResponseConfirmationRequired:
44+
return IntentResponseCode_confirmationRequired
3945
case *IntentResponseIdToken:
4046
return IntentResponseCode_idToken
4147
default:

intents/intent_typed.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ func IntentDataTypeToName[T any](t *T) IntentName {
3939
return IntentName_federateAccount
4040
case *IntentDataRemoveAccount:
4141
return IntentName_removeAccount
42+
case *IntentDataAdoptChildWallet:
43+
return IntentName_adoptChildWallet
44+
case *IntentDataGetAdopter:
45+
return IntentName_getAdopter
46+
case *IntentDataConfirmIntent:
47+
return IntentName_confirmIntent
48+
case *IntentDataGetConfirmationStatus:
49+
return IntentName_getConfirmationStatus
4250
case *IntentDataGetIdToken:
4351
return IntentName_getIdToken
4452
default:

0 commit comments

Comments
 (0)