You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: DESIGN.md
+16-6
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,9 @@
2
2
3
3
## Structure
4
4
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.
7
6
8
7
To address this goal, the SDK is structured into layers
9
-
10
8
```
11
9
core/ -- Low level packages
12
10
base/ -- Constants and utilities
@@ -33,21 +31,34 @@ examples/ -- Examples, also used for README string replace
33
31
34
32
# Interfaces
35
33
34
+
Interfaces defined in `core/definitions` are implemented for each platform on which they are supported.
35
+
36
36
## Platform Interfaces
37
37
38
38
Several interfaces should be available for each platform supported.
39
39
40
40
- A `Platform` is a blockchain runtime, often shared across a number of chains (e.g. `Evm` platform for `Ethereum`, `Bsc`, `Polygon`, etc ...).
41
+
41
42
- 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
+
43
44
- An `Address` provides parsing/formatting/conversion for platform specific addresses.
44
45
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
+
45
50
## Protocol Interfaces
46
51
47
52
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...)
48
53
49
54
To allow platform agnostic access to Protocols, each Platform that provides the protocol should have its own implementation.
50
55
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
+
51
62
# Connect package
52
63
53
64
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,
64
75
65
76
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.
66
77
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.
Copy file name to clipboardexpand all lines: notes.md
+5-2
Original file line number
Diff line number
Diff line change
@@ -35,13 +35,16 @@ The [nativeChainIds](./core/base/src/constants/nativeChainIds.ts) constants mix
35
35
36
36
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".
37
37
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".
39
39
40
40
This would constitute a large change since the Network type is a generic parameter for many other types.
41
41
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
+
42
44
### Definitions
43
45
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.
45
48
46
49
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">`
0 commit comments