Skip to content

Commit 8c6f94f

Browse files
committed
more
1 parent d02c241 commit 8c6f94f

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

DESIGN.md

+16-6
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
## Structure
44

5-
A primary goal for the SDK was to provide modular and specific access to the protocols build on Wormhole.
6-
5+
A primary goal for the SDK is to provide modular and specific access to the protocols build on Wormhole.
76

87
To address this goal, the SDK is structured into layers
9-
108
```
119
core/ -- Low level packages
1210
base/ -- Constants and utilities
@@ -33,21 +31,34 @@ examples/ -- Examples, also used for README string replace
3331

3432
# Interfaces
3533

34+
Interfaces defined in `core/definitions` are implemented for each platform on which they are supported.
35+
3636
## Platform Interfaces
3737

3838
Several interfaces should be available for each platform supported.
3939

4040
- A `Platform` is a blockchain runtime, often shared across a number of chains (e.g. `Evm` platform for `Ethereum`, `Bsc`, `Polygon`, etc ...).
41+
4142
- A `Chain` is a specific blockchain, potentially with overrides for slight differences in the platform implementation.
42-
- A `Signer` is an interface that provides a callback to `sign` or `signAndSend` one or more transaction objects.
43+
4344
- An `Address` provides parsing/formatting/conversion for platform specific addresses.
4445

46+
- A `Signer` is an interface that provides a callback to `sign` or `signAndSend` one or more transaction objects.
47+
48+
> The Signer interface is intended to be flexible enough to allow devs to provide their own implementation with more specific transaction creation/configuration/submission logic than what could be covered in the default provided signers. It also allows for the creation of Signers that wrap hardware wallets or web wallets.
49+
4550
## Protocol Interfaces
4651

4752
A Protocol (fka `Module`) is a specific application, it provides a set of methods that can be called to accomplish some action (e.g. `TokenBridge` allows `transfer`/`redeem`/`getWrappedAsset`, etc...)
4853

4954
To allow platform agnostic access to Protocols, each Platform that provides the protocol should have its own implementation.
5055

56+
# Platform packages
57+
58+
Each platform has implementations of the relevant interfaces from `core/definitions` as well as implementations for each protocol supported on that platform.
59+
60+
The platform package should be the only one that depends on packages for that platform (eg ethersv6 for evm).
61+
5162
# Connect package
5263

5364
The `connect` package provides access to all the `Platform` and `Protocol` implementations through their interfaces.
@@ -64,5 +75,4 @@ Because this project has strict separation of platform implementation packages,
6475

6576
This package specifies _all_ platforms and protocols as dependencies which increases installed size but provides provides conditional exports for each `Platform` to allow for a smaller bundle size.
6677

67-
Each platform has a `PlatformDefiniton` containing the `Platform` specific implementations that can be imported directly or through the `PlatformLoader` which ensures the protocols are registered as well.
68-
78+
Each platform has a `PlatformDefiniton` containing the `Platform` specific implementations that can be imported directly or through the `PlatformLoader` which ensures the protocols are registered as well.

notes.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ The [nativeChainIds](./core/base/src/constants/nativeChainIds.ts) constants mix
3535

3636
The [Network](./core/base/src/constants/networks.ts) value "Devnet" is confusing to folks coming from Solana since it refers to some ci or local network configuration profile and what they actually want is "Testnet".
3737

38-
The network breakdown might serve better as a named configuration profile instead where the dev would not have to, for example, map the name "Ethereum" to (Mainnet->Ethereum, Testnet->Sepolia), rather, that would be part of the configuration profile definition. Possibly defined as overrides from the defaults of "Mainnet"|"Testnet"|"Devnet".
38+
The network breakdown might serve better as a named configuration profile instead, where the dev would not have to, for example, map the name "Ethereum" to (Mainnet->Ethereum, Testnet->Sepolia), rather, that would be part of the configuration profile definition. Possibly defined as overrides from the defaults of "Mainnet"|"Testnet"|"Devnet".
3939

4040
This would constitute a large change since the Network type is a generic parameter for many other types.
4141

42+
The [layouts](./core/base/src/utils/layout/index.ts) could be broken out into their own package for more generic uses outside the context of the wormhole sdk.
43+
4244
### Definitions
4345

44-
The [layouts](./core/definitions/src/protocols/tokenBridge/tokenBridgeLayout.ts) for the protocols are very difficult to read/comprehend from just source. We could have some way to write out the full object produced so that the fields it contains are easier to read.
46+
47+
The [layout definitions](./core/definitions/src/protocols/tokenBridge/tokenBridgeLayout.ts) for the protocols are very difficult to read/comprehend from just source. We could have some way to write out the full object produced so that the fields it contains are easier to read.
4548

4649
The [Attestation/AttestationId](./core/definitions/src/attestation.ts) could be registered along with the protocol instead of having a hardcoded switch case. The current definition makes it very awkward to use for anything outside this repo, but since its used in the Routes, external "plugins" need to have _something_. This forces the Attestation type to be a punted `VAA<"Uint8Array">`
4750

0 commit comments

Comments
 (0)