-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TBRv3 library issues #104
base: main
Are you sure you want to change the base?
Conversation
…d them to peerDependency
// FIXME: This should be in wormhole typescript sdk in the token bridge protocol for Solana: | ||
// https://github.com/wormhole-foundation/wormhole-sdk-ts/blob/a0daa3869620ddcddd87c073941de7d9ec65b38c/platforms/solana/protocols/tokenBridge/src/utils/tokenBridge/accounts/wrapped.ts#L60-L94 | ||
// Last updated sequence only exists in Testnet: | ||
// https://github.com/wormhole-foundation/wormhole/blob/7bd40b595e22c5512dfaa2ed8e6d7441df743a69/solana/programs/token-bridge/src/legacy/state/wrapped_asset.rs#L32-L35 | ||
{ name: 'lastUpdatedSequence', binary: 'bytes', custom: { | ||
to: (encoded: Uint8Array) => { | ||
if (encoded.length === 0) return undefined; | ||
if (encoded.length === 8) return deserializeLayout(uint64Layout, encoded); | ||
throwError('Invalid lastUpdatedSequence length'); | ||
}, | ||
from: (decoded: bigint | undefined) => | ||
decoded === undefined ? new Uint8Array(0) : serializeLayout(uint64Layout, decoded), | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the rollback of the token bridge on testnet, this part has now become unnecessary... perfect timing... was there just long enough to hurt us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so this entire field can be removed, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed!
const wrapMetaLayout = [ | ||
{ name: 'chain', ...layoutItems.chainItem(), endianness: 'little' }, | ||
{ name: 'address', ...layoutItems.universalAddressItem }, | ||
{ name: 'decimals', binary: 'uint', size: 1 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should should also be in the wormhole typescript SDK (@real-felix)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet another item to add to the list
const allowedTokenAddresses = this.config?.allowedTokenAddresses || []; | ||
const isWhitelistConfigAvailable = this.config && allowedTokenAddresses.length > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's all this about? This does not exactly fit the theme of the repo name of "arbitrary-token-transfers", no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nonergodic It is funny because I asked the same question. They want this restriction to prevent users from bridging useless tokens. By default is inactive and I believe that this feature will only be used in Portal Bridge UI.
@solanoepalacio can give you more default about this.
const wrapMetaLayout = [ | ||
{ name: 'chain', ...layoutItems.chainItem(), endianness: 'little' }, | ||
{ name: 'address', ...layoutItems.universalAddressItem }, | ||
{ name: 'decimals', binary: 'uint', size: 1 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet another item to add to the list
peerDependency
to avoid the collision of multiple Wormhole SDK versions in one project.