Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3372851
feat: 2311 module thor/thorest/account fix
lucanicoladebiasi Aug 30, 2025
04472be
feat: 2311 TransactionRequest.ts hierarchy tests
lucanicoladebiasi Aug 30, 2025
9770704
feat: 2311 thor/thorest/signer module
lucanicoladebiasi Aug 30, 2025
38d5f90
feat: 2311 thor/thorest/signer module
lucanicoladebiasi Aug 30, 2025
c9af332
feat: 2311 thor/thorest/signer module
lucanicoladebiasi Aug 30, 2025
1ee50a6
feat: 2311 thor/thorest/signer module
lucanicoladebiasi Aug 30, 2025
e473b9b
feat: 2311 thor/thorest/signer module tests
lucanicoladebiasi Aug 30, 2025
6a8bb62
feat: 2311 thor/thorest/signer module tests
lucanicoladebiasi Aug 30, 2025
fd57b9d
feat: 2311 FQP constants updated
lucanicoladebiasi Aug 30, 2025
1e84845
feat: 2311 @thor.thorest.model UML
lucanicoladebiasi Aug 31, 2025
a2c47b0
feat: 2311 @thor.thorest.model UML
lucanicoladebiasi Aug 31, 2025
5ce178c
feat: 2311 @thor.thorest.signer UML
lucanicoladebiasi Aug 31, 2025
0ee2df4
Merge branch 'sdk-v3' into 2311-sdkv3---transaction-request-and-signer
lucanicoladebiasi Sep 2, 2025
84609ae
feat: 2311 import barrel circular dependencies solved
lucanicoladebiasi Sep 2, 2025
219df88
feat: 2311 import barrel circular dependencies solved
lucanicoladebiasi Sep 2, 2025
25696d9
Merge remote-tracking branch 'origin/2311-sdkv3---transaction-request…
lucanicoladebiasi Sep 2, 2025
3cc7e73
feat: 2311 RLP decode...
lucanicoladebiasi Sep 3, 2025
398e478
feat: 2429 PrivateKeySigner.ts agreed
lucanicoladebiasi Sep 3, 2025
f123a60
Merge branch '2311-sdkv3---transaction-request-and-signer' into 2404-…
lucanicoladebiasi Sep 3, 2025
52c4038
feat: 2404 RLPCodec decode...
lucanicoladebiasi Sep 3, 2025
5ca376c
Merge branch 'refs/heads/sdk-v3' into 2404-sdkv3---transaction-reques…
lucanicoladebiasi Sep 4, 2025
0e47231
feat: 2404 RLPCodec decode...
lucanicoladebiasi Sep 5, 2025
cf7f639
feat: 2404 RLPCodec decode...
lucanicoladebiasi Sep 5, 2025
475be3b
feat: 2404 RLPCodec decode...
lucanicoladebiasi Sep 5, 2025
9336805
feat: 2404 RLPCodec decode...
lucanicoladebiasi Sep 6, 2025
8ab1c08
feat: 2404 RLPCodec decode...
lucanicoladebiasi Sep 6, 2025
f178327
feat: 2404 WalletClient.ts uses TransactionRequest.ts...
lucanicoladebiasi Sep 6, 2025
033d38a
feat: 2404 WalletClient.ts documented
lucanicoladebiasi Sep 7, 2025
f6b7724
feat: 2404 WalletClient.ts unit tests
lucanicoladebiasi Sep 7, 2025
82fbf20
feat: 2404 WalletClient.ts unit tests
lucanicoladebiasi Sep 9, 2025
9971182
Merge branch 'sdk-v3' into 2404-sdkv3---transaction-request-in-wallet…
lucanicoladebiasi Sep 10, 2025
303547a
feat: 2404 UML reorganized
lucanicoladebiasi Sep 10, 2025
d2389af
feat: 2404 packages/sdk/tests/viem/clients/WalletClient.demo.test.ts
lucanicoladebiasi Sep 10, 2025
4827cfc
Merge branch 'sdk-v3' into 2404-sdkv3---transaction-request-in-wallet…
lucanicoladebiasi Sep 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ classDiagram
}
class SignedTransactionRequest {
constructor(SignedTransactionRequestParam param)
SignedTransactionRequestJSON toJSON()
}
class SignedTransactionRequestParam {
<<interface>>
Expand All @@ -68,9 +69,11 @@ classDiagram
}
class SponsoredTransactionRequest {
constructor(SponsoredTransactionRequestParam: param)
SponsoredTransactionRequestJSON toJSON()
}
class TransactionRequest {
constructor(TransactionRequestParam param)
TransactionRequestJSON toJSON()
}
class TransactionRequestParams {
<<interface>>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ classDiagram
}
}
class RLPCodec {
Uint8Array encodeSignedTransactionRequest(SignedTransactionRequest transactionRequest)
Uint8Array encodeTransactionRequest(TransactionRequest transactionRequest)
TransactionRequest|SignedTransactionRequest|SponsoredTransactionRequest decode(Uint8Array encoded)
Uint8Array encode(TransactionRequest|SignedTransactionRequest|SponsoredTransactionRequest transactionRequest)
}
class PrivateKeySigner {
constructor(Uint8Array privateKey)
void()
disponse()
}
class Signer {
<<interface>>
Expand Down
91 changes: 91 additions & 0 deletions docs/viem/walletClient.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: "@viem.clients.walletClient"
---
classDiagram
class CreateEventFilterParams {
Address|Address[] address
AbiEvent event
Hex[] args
bigint fromBlock
bigint toBlock
}
class GetFilterChangesParams {
<<interface>>
Filter filter
}
class GetFilterLogParams {
<<interface>>
Filter filter
}
class PrepareTransactionRequestRequest {
<<interface>>
Address to
Hex|number value
Hex data
string comment
Hex abi
Hex blockRef
number chainTag
Hex dependsOn
number expiration
Hex|number gas
number gasPriceCoef
number nonce
boolean isIntendedToBeSponsored
}
class PublicClient {
URL|ThorNetwork network
constructor(URL|ThorNetwork network, HttpClient transport)
Promise~ExecuteCodesResponse~ call(ExecuteCodesRequestJSON request)
Promise~BlockFilter~ createBlockFilter()
EventFilter createEventFilter(CreateEventFilterParams params)
PendingTransactionFilter createPendingTransactionFilter()
Promise~bigint~ getBalance(Address address)
Promise~ExpandedBlockResponse|RawTx|RegularBlockResponse|null~ getBlock(BlockRevision revision, BlockReponseType type)
Promise~number|undefined~ getBlockNumber(BlockRevision revision)
Promise~number|undefined~ getBlockTransactionCount(BlockRevision revision)
Promise~Hex|undefined~ getBytecode(Address address)
Promise~bigint~ getChainId()
Promise~ex|undefined~ getCode(Address address)
Promise~FeeHistory~ getFeeHistory(number blockCount)
Promise~Array~DecodedEventLog|string~~ getFilterChanges(GetFilterChangesParams params)
Promise~DecodedEventLog[]~ getFilterLogs(GetFilterLogParams params)
Promise~bigint[]~ getGasPrice()
Promise~DecodedEventLog[]~ getLogs(EventFilter eventFilter)
Promise~number~ getNonce(Address address)
Promise~Hex~ getStorageAt(Address address, Hex slot)
Promise~GetTxResponse|null~ getTransaction(hash: Hex)
Promise~number~ getTransactionCount(Address address)
Promise~GetTxReceiptResponse|null~ getTransactionReceipt(Hex hash)
Promise~bigint|undefined~ estimateFeePerGas()
Promise~EstimatedGas[]~ estimateGas(ExecuteCodesRequestJSON request)
Promise~ExecuteCodesResponse~ simulateCalls(ExecuteCodesRequestJSON request)
Promise~bigint~ suggestPriorityFeeRequest()
void unistallFilter(BeatsSubscription|BlocksSubscription|EventsSubscription|NewTransactionSubscription|TransfersSubscription subscription)
BlocksSubscription watchBlocks(Hex pos)
BlocksSubscription watchBlockNumber()
void watchEvent(WatchEventParams params)
}
class WatchEventParams {
<<interface>>
Function~SubscriptionEventResponse[] logs~ onLogs
Function~Error error~ onError
Address address;
Hex event
Hex[] args
Hex fromBlock
}
class WalletClient {
constructor(URL|ThorNeetwork network, HttpClient transport, Account|null account)
Address[] getAddresses()
TransactionRequest prepareTransactionRequest(PrepareTransactionRequestRequest request)
Promise~Hex~ sendRawTransaction(Hex raw)
Promise~Hex~ sendTransaction(PrepareTransactionRequestRequest|SignedTransactionRequest request)
Promise~Hex~ signTransaction(PrepareTransactionRequestRequest|SignedTransactionRequest request)
}
PublicClient <|-- WalletClient
CreateEventFilterParams "PublicClient.createEventFilter(...)" -- PublicClient
GetFilterChangesParams "PublicClient.getFilterChanges(...)" -- PublicClient
GetFilterLogParams "PublicClient.getFilterLogs(...)" -- PublicClient
PrepareTransactionRequestRequest "WalletClient.sendTransaction() WalletClient.signTransaction(...)" -- WalletClient
WatchEventParams "PublicClient.watchEvent(...)" -- PublicClient
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { type TransactionRequestJSON } from '@thor/thorest/json/TransactionRequestJSON';

/**
* Represents the content of a {@link SignedTransactionRequest} object in JSON format.
*/
interface SignedTransactionRequestJSON extends TransactionRequestJSON {
origin: string; // hex address
originSignature: string; // hex origin signature
signature: string; // hex signature
}

export { type SignedTransactionRequestJSON };
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { type SignedTransactionRequestJSON } from '@thor/thorest/json/SignedTransactionRequestJSON';

/**
* Represents the content of a {@link SponsoredTransactionRequest} object in JSON format.
*/
interface SponsoredTransactionRequestJSON extends SignedTransactionRequestJSON {
gasPayer: string; // hex address
gasPayerSignature: string; // hex signature
}

export { type SponsoredTransactionRequestJSON };
18 changes: 18 additions & 0 deletions packages/sdk/src/thor/thorest/json/TransactionRequestJSON.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { type ClauseJSON } from '@thor/thorest/json/ClauseJSON';

/**
* Represents the content of a {@link TransactionRequest} object in JSON format.
*/
interface TransactionRequestJSON {
blockRef: string;
chainTag: number;
clauses: ClauseJSON[];
dependsOn: string | null;
expiration: number;
gas: bigint;
gasPriceCoef: bigint;
nonce: number;
isIntendedToBeSponsored: boolean;
}

export { type TransactionRequestJSON };
3 changes: 3 additions & 0 deletions packages/sdk/src/thor/thorest/json/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ export * from './EventJSON';
export * from './OutputJSON';
export * from './ReceiptJSON';
export * from './ReceiptMetaJSON';
export * from './SignedTransactionRequestJSON';
export * from './SponsoredTransactionRequestJSON';
export * from './TransferJSON';
export * from './TransferJSON';
export * from './TransactionRequestJSON';
export * from '../transactions/json';
export * from '../blocks/json';
export * from '../debug/json';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
TransactionRequest,
type TransactionRequestParam
} from './TransactionRequest';
import type { Address } from '@common';
import { type Address, HexUInt } from '@common';
import { type SignedTransactionRequestJSON } from '@thor/thorest/json';

/**
* Represents the parameters required for a signed transaction request.
Expand Down Expand Up @@ -76,6 +77,20 @@ class SignedTransactionRequest
public isSigned(): boolean {
return true;
}

/**
* Converts the SignedTransactionRequest object into its JSON representation.
*
* @return {SignedTransactionRequestJSON} The JSON representation of the SignedTransactionRequest object.
*/
public toJSON(): SignedTransactionRequestJSON {
return {
...super.toJSON(),
origin: this.origin.toString(),
originSignature: HexUInt.of(this.originSignature).toString(),
signature: HexUInt.of(this.signature).toString()
} satisfies SignedTransactionRequestJSON;
}
}

export { type SignedTransactionRequestParam, SignedTransactionRequest };
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { type Address } from '@common';
import { type Address, HexUInt } from '@common';

import { type SponsoredTransactionRequestJSON } from '@thor/thorest/json';
import {
SignedTransactionRequest,
type SignedTransactionRequestParam
} from './SignedTransactionRequest';
} from '@thor/thorest/model';

/**
* Represents the parameters required for a sponsored transaction request.
Expand Down Expand Up @@ -52,6 +54,19 @@ class SponsoredTransactionRequest
this.gasPayer = params.gasPayer;
this.gasPayerSignature = new Uint8Array(params.gasPayerSignature);
}

/**
* Converts the SponsoredTransactionRequest object into its JSON representation.
*
* @return {SponsoredTransactionRequestJSON} The JSON representation of the SponsoredTransactionRequest object.
*/
toJSON(): SponsoredTransactionRequestJSON {
return {
...super.toJSON(),
gasPayer: this.gasPayer.toString(),
gasPayerSignature: HexUInt.of(this.gasPayerSignature).toString()
} satisfies SponsoredTransactionRequestJSON;
}
}

export { SponsoredTransactionRequest, type SponsoredTransactionRequestParam };
20 changes: 20 additions & 0 deletions packages/sdk/src/thor/thorest/model/TransactionRequest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type Clause } from '@thor';
import { type Hex } from '@common';
import { type TransactionRequestJSON } from '@thor/thorest/json';

/**
* Represents the parameters required to create a {@link TransactionRequest} instance.
Expand Down Expand Up @@ -145,6 +146,25 @@ class TransactionRequest implements TransactionRequestParam {
public isSigned(): boolean {
return false;
}

/**
* Converts the TransactionRequest object into a JSON representation.
*
* @return {TransactionRequestJSON} The JSON representation of the TransactionRequest object.
*/
public toJSON(): TransactionRequestJSON {
return {
blockRef: this.blockRef.toString(),
chainTag: this.chainTag,
clauses: this.clauses.map((clause: Clause) => clause.toJSON()),
dependsOn: this.dependsOn?.toString() ?? null,
expiration: this.expiration,
gas: this.gas,
gasPriceCoef: this.gasPriceCoef,
nonce: this.nonce,
isIntendedToBeSponsored: this.isIntendedToBeSponsored
} satisfies TransactionRequestJSON;
}
}

export { TransactionRequest, type TransactionRequestParam };
Loading
Loading