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
solana/ -- Contains Solana `Platform` and `Protocol` implementations
27
27
etc...
28
28
29
-
sdk/ -- Metapackage that depeneds on the rest of the packages, meant to be a simpler way to install/use. Exports packages in a way that allows for tree shaking unused packages and splitting chunks.
29
+
sdk/ -- Metapackage that depeneds on the rest of the packages, meant to be a simpler way to install/use.
30
30
31
31
examples/ -- Examples, also used for README string replace
32
32
```
@@ -48,6 +48,14 @@ A Protocol (fka `Module`) is a specific application, it provides a set of method
48
48
49
49
To allow platform agnostic access to Protocols, each Platform that provides the protocol should have its own implementation.
50
50
51
+
# Connect package
52
+
53
+
The `connect` package provides access to all the `Platform` and `Protocol` implementations through their interfaces.
54
+
55
+
The `Wormhole` class represents a context to register specific Platforms and set some initial configuration overrides. It provides utility methods to do things like create a `ChainContext` or parse an address.
56
+
57
+
The `routes` directory contains the logic to make use of the Protocol implementations by composing a route through the use of one or more Protocol interfaces.
58
+
51
59
# SDK package
52
60
53
61
The `@wormhole-foundation/sdk` package was created to reduce the confusion reported by devs around what they needed to install and use.
Copy file name to clipboardexpand all lines: notes.md
+17-6
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ This document details some things that could be improved about the SDK.
8
8
9
9
The [token registry](./tokenRegistry/) directory is unused except for importing the tokens from connect, which is no longer necessary.
10
10
11
-
It is still possible to screw up a transfer (blackhole funds) if the higher level constructs are not used and care is not taken to produce a transfer that is acceptable by the destination chain. I have no suggestions for this that would prevent the platform-specific-oddities from leaking into packages they have no business in besides "better documentation".
11
+
It is still possible to screw up a transfer (blackhole funds) if the higher level constructs (`WormholeTransfer` or `Route`) are not used and care is not taken to produce a transfer that is acceptable by the destination chain. I have no suggestions for this that would prevent the platform-specific-oddities from leaking into packages they have no business in besides "better documentation" or disallow it completely.
12
12
13
13
Examples:
14
14
@@ -27,7 +27,7 @@ Examples:
27
27
28
28
### Base
29
29
30
-
The [tokens](./core/base/src/constants/tokens) consts take up a lot of packed space for marginal benefit. Consider making these a wholly separate package that _can_ be installed and fetched when necessary.
30
+
The [tokens](./core/base/src/constants/tokens) consts take up a lot of packed space in a widely used package for marginal benefit. Consider making these a wholly separate package that _can_ be installed and fetched when necessary.
31
31
32
32
The [nativeChainIds](./core/base/src/constants/nativeChainIds.ts) constants mix different chain id types, causing extra akward type checks to be done. Consider splitting these by platform so that when a `Chain` is passed, the type of chain id can be inferred. Also will help to distinguish between chain id _kinds_ (eip155 vs whatever) since they should be unique at least in that context.
33
33
@@ -51,12 +51,24 @@ The [protocols](./core/definitions/src/protocols/) should have *standard* fields
51
51
- A disciminator/serde for its VAAs/payloads
52
52
- Standardized Errors that may be thrown
53
53
54
+
Note: it is possible to enforce a namespace adheres to an interface
55
+
```ts
56
+
interfacex { doit():void; }
57
+
interfacez { dont():void; }
58
+
namespacey { exportfunction doit () { return; } }
59
+
// ok
60
+
ysatisfiesx;
61
+
// not ok, will not compile
62
+
// y satisfies z;
63
+
```
54
64
55
-
## Connect
56
65
66
+
## Connect
57
67
58
68
The [Wormhole](./connect/src/wormhole.ts) class has spotty coverage of util methods. Some of the methods are awkward to have on `Wormhole` like `canonicalAddress` which is already an exported method.
59
69
70
+
Getting decent typehints for the [Route](./connect/src/routes/route.ts) implementations has been rough. We should, in the route, provide a typeguard that can be called to narrow the type to itself. This would be helpful to understand the exact types required as input (specific options per route, etc) and what is returned on output (more detailed route specific quote details, etc).
71
+
60
72
The [Receipt typeguards](./connect/src/types.ts) should also define `hasSourceInitiated`, `hasAttested`, etc for checking if the transfer is _past_ some step.
61
73
62
74
The [Wormholescan API](./connect/src/whscan-api.ts) should be better documented and possibly autogenerated from the swagger for the api.
@@ -67,7 +79,7 @@ The classes that implement the [WormholeTransfer](./connect/src/protocols/wormho
67
79
68
80
Every Protocol implementation defines its own private `createUnsignedTransaction` function, which, kinda sucks.
69
81
70
-
The Signer implementations are bad at things like gas estimation or handling errors. It should also provide support for transaction review prior to signing.
82
+
The Signer implementations are bad at things like gas estimation or handling errors. They should also provide support for transaction review prior to signing.
71
83
72
84
73
85
### Evm
@@ -94,5 +106,4 @@ The IBC protocol implementation should probably have just been `Gateway` instead
94
106
95
107
### Sui
96
108
97
-
Disaster show wrt types, a lot of weird type checking to get some deeply nested field in a MoveValue.
98
-
109
+
Disaster show wrt types, a lot of weird type checking to get some deeply nested field in a MoveValue.
0 commit comments