Skip to content

Commit

Permalink
intent.ridl update
Browse files Browse the repository at this point in the history
  • Loading branch information
marino39 committed Feb 12, 2024
1 parent b3d904c commit eb95505
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 37 deletions.
60 changes: 57 additions & 3 deletions intents/intent.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 57 additions & 3 deletions intents/intent.gen.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
// sequence-waas-intents v0.1.0 2e194b57788277e83563e48f4a88fac890a5a069
// sequence-waas-intents v0.1.0 a199ec1e7889726ed0a6468c1b434f4a2da44728
// --
// Code generated by [email protected] with typescript generator. DO NOT EDIT.
//
Expand All @@ -12,7 +12,7 @@ export const WebRPCVersion = "v1"
export const WebRPCSchemaVersion = "v0.1.0"

// Schema hash generated from your RIDL schema
export const WebRPCSchemaHash = "2e194b57788277e83563e48f4a88fac890a5a069"
export const WebRPCSchemaHash = "a199ec1e7889726ed0a6468c1b434f4a2da44728"

//
// Types
Expand Down Expand Up @@ -41,7 +41,6 @@ export interface IntentDataOpenSession {

export interface IntentDataCloseSession {
sessionId: string
wallet: string
}

export interface IntentDataValidateSession {
Expand All @@ -52,11 +51,13 @@ export interface IntentDataValidateSession {

export interface IntentDataFinishValidateSession {
sessionId: string
wallet: string
salt: string
challenge: string
}

export interface IntentDataListSessions {
wallet: string
}

export interface IntentDataGetSession {
Expand Down Expand Up @@ -124,6 +125,59 @@ export interface IntentResponse {
data: any
}

export interface IntentResponseSessionOpened {
sessionId: string
wallet: string
}

export interface IntentResponseSessionClosed {
}

export interface IntentResponseValidateSession {
}

export interface IntentResponseValidationRequired {
sessionId: string
}

export interface IntentResponseValidationStarted {
salt: string
}

export interface IntentResponseValidationFinished {
isValid: boolean
}

export interface IntentResponseListSessions {
sessions: Array<string>
}

export interface IntentResponseGetSession {
sessionId: string
wallet: string
validated: boolean
}

export interface IntentResponseSignedMessage {
signature: string
message: string
}

export interface IntentResponseTransactionReceipt {
request: any
txHash: string
metaTxHash: string
receipt: any
nativeReceipt: any
simulations: any
}

export interface IntentResponseTransactionFailed {
error: string
request: any
simulations: any
}



const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => {
Expand Down
46 changes: 40 additions & 6 deletions intents/intent.ridl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ struct IntentDataOpenSession

struct IntentDataCloseSession
- sessionId: string
- wallet: string

struct IntentDataValidateSession
- sessionId: string
Expand All @@ -42,10 +41,13 @@ struct IntentDataValidateSession

struct IntentDataFinishValidateSession
- sessionId: string
- wallet: string
- salt: string
- challenge: string

struct IntentDataListSessions
- wallet: string


struct IntentDataGetSession
- sessionId: string
Expand Down Expand Up @@ -111,24 +113,56 @@ struct IntentResponse
- code: string
- data: any

# no way to generate string enums
#enum IntentResponseCode: string
# - sessionOpened
# - validationRequired
# - validationStarted
# - validationFinished
# - signedMessage
# - transactionReceipt
# - transactionFailed
# - getSessionResponse

struct IntentResponseSessionOpened
- sessionId: string
- wallet: string

struct IntentResponseSessionClosed

struct IntentResponseValidateSession

struct IntentResponseFinishValidateSession
struct IntentResponseValidationRequired
- sessionId: string

struct IntentResponseValidationStarted
- salt: string

struct IntentResponseValidationFinished
- isValid: bool

struct IntentResponseListSessions
- sessions: []string

struct IntentResponseGetSession
- isValid: bool
- sessionId: string
- wallet: string
- validated: bool

struct IntentResponseSignMessage
struct IntentResponseSignedMessage
- signature: string
- message: string

struct IntentResponseTransactionReceipt
- request: any
- txHash: string
- metaTxHash: string
- receipt: any
- nativeReceipt: any
- simulations: any

struct IntentResponseSendTransaction
struct IntentResponseTransactionFailed
- error: string
- request: any
- simulations: any

struct IntentResponseSendFail
22 changes: 22 additions & 0 deletions intents/intent_ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,28 @@ const (
KeyTypeUnknown
)

const (
IntentNameOpenSession = "openSession"
IntentNameCloseSession = "closeSession"
IntentNameValidateSession = "validateSession"
IntentNameFinishValidateSession = "finishValidateSession"
IntentNameListSessions = "listSessions"
IntentNameGetSession = "getSession"
IntentNameSignMessage = "signMessage"
IntentNameSendTransaction = "sendTransaction"
)

const (
IntentResponseCodeSessionOpened = "sessionOpened"
IntentResponseCodeValidationRequired = "validationRequired"
IntentResponseCodeValidationStarted = "validationStarted"
IntentResponseCodeValidationFinished = "validationFinished"
IntentResponseCodeSignedMessage = "signedMessage"
IntentResponseCodeTransactionReceipt = "transactionReceipt"
IntentResponseCodeTransactionFailed = "transactionFailed"
IntentResponseCodeGetSessionResponse = "getSessionResponse"
)

type IntentDataValidator interface {
IsValid() error
}
Expand Down
16 changes: 8 additions & 8 deletions intents/intent_typed.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ func IntentDataTypeToName[T any](t *T) string {
var data any = t
switch data.(type) {
case *IntentDataOpenSession:
return "openSession"
return IntentNameOpenSession
case *IntentDataCloseSession:
return "closeSession"
return IntentNameCloseSession
case *IntentDataValidateSession:
return "validateSession"
return IntentNameValidateSession
case *IntentDataFinishValidateSession:
return "finishValidateSession"
return IntentNameFinishValidateSession
case *IntentDataListSessions:
return "listSessions"
return IntentNameListSessions
case *IntentDataGetSession:
return "getSession"
return IntentNameGetSession
case *IntentDataSignMessage:
return "signMessage"
return IntentNameSignMessage
case *IntentDataSendTransaction:
return "sendTransaction"
return IntentNameSendTransaction
default:
return ""
}
Expand Down
Loading

0 comments on commit eb95505

Please sign in to comment.