Skip to content

Commit

Permalink
Add getTransactionReceipt intent (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrislav authored Mar 12, 2024
1 parent fded76d commit 5f51ee3
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 14 deletions.
31 changes: 20 additions & 11 deletions intents/intent.gen.go

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

12 changes: 9 additions & 3 deletions intents/intent.gen.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable */
// sequence-waas-intents v0.1.0 80bee7d15d1c82c2791adf35c50c7b9d70dc49bc
// sequence-waas-intents v0.1.0 2c4dea0eacfd30c622628970fba756e9f4a21e61
// --
// Code generated by webrpc-gen@v0.14.0-dev with typescript generator. DO NOT EDIT.
// Code generated by webrpc-gen@v0.15.0-dev with typescript generator. DO NOT EDIT.
//
// webrpc-gen -schema=intent.ridl -target=typescript -client -out=./intent.gen.ts

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 = "80bee7d15d1c82c2791adf35c50c7b9d70dc49bc"
export const WebRPCSchemaHash = "2c4dea0eacfd30c622628970fba756e9f4a21e61"

//
// Types
Expand Down Expand Up @@ -92,6 +92,12 @@ export interface IntentDataSendTransaction {
transactionsFeeQuote?: string
}

export interface IntentDataGetTransactionReceipt {
network: string
wallet: string
metaTxHash: string
}

export interface TransactionRaw {
type: string
to: string
Expand Down
6 changes: 6 additions & 0 deletions intents/intent.ridl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct Signature
# - getSession
# - signMessage
# - sendTransaction
# - getTransactionReceipt

struct IntentDataOpenSession
- sessionId: string
Expand Down Expand Up @@ -82,6 +83,11 @@ struct IntentDataSendTransaction
- transactionsFeeQuote?: string
+ go.tag.json = transactionsFeeQuote,omitempty

struct IntentDataGetTransactionReceipt
- network: string
- wallet: string
- metaTxHash: string

struct TransactionRaw
- type: string
- to: string
Expand Down
23 changes: 23 additions & 0 deletions intents/intent_data_get_transaction_receipt_ext.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package intents

import (
"fmt"
"math/big"

"github.com/0xsequence/ethkit/go-ethereum/common"

"github.com/0xsequence/go-sequence"
)

func (p *IntentDataGetTransactionReceipt) chainID() (*big.Int, error) {
n, ok := sequence.ParseHexOrDec(p.Network)
if !ok {
return nil, fmt.Errorf("invalid network id '%s'", p.Network)
}

return n, nil
}

func (p *IntentDataGetTransactionReceipt) wallet() common.Address {
return common.HexToAddress(p.Wallet)
}
1 change: 1 addition & 0 deletions intents/intent_ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
IntentNameSignMessage = "signMessage"
IntentNameFeeOptions = "feeOptions"
IntentNameSendTransaction = "sendTransaction"
IntentNameGetTransactionReceipt = "getTransactionReceipt"
)

const (
Expand Down
2 changes: 2 additions & 0 deletions intents/intent_typed.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func IntentDataTypeToName[T any](t *T) string {
return IntentNameFeeOptions
case *IntentDataSendTransaction:
return IntentNameSendTransaction
case *IntentDataGetTransactionReceipt:
return IntentNameGetTransactionReceipt
default:
return ""
}
Expand Down

0 comments on commit 5f51ee3

Please sign in to comment.