Skip to content

Commit

Permalink
stub out new package for Sui CCTP protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
artursapek committed Oct 11, 2024
1 parent fa4ba4b commit 8449747
Show file tree
Hide file tree
Showing 6 changed files with 131 additions and 0 deletions.
75 changes: 75 additions & 0 deletions platforms/sui/protocols/cctp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "@wormhole-foundation/sdk-sui-cctp",
"version": "0.10.9",
"repository": {
"type": "git",
"url": "git+https://github.com/wormhole-foundation/wormhole-sdk-ts.git"
},
"bugs": {
"url": "https://github.com/wormhole-foundation/wormhole-sdk-ts/issues"
},
"homepage": "https://github.com/wormhole-foundation/wormhole-sdk-ts#readme",
"directories": {
"test": "tests"
},
"license": "Apache-2.0",
"main": "./dist/cjs/index.js",
"types": "./dist/cjs/index.d.ts",
"module": "./dist/esm/index.js",
"description": "SDK for Sui chains, used in conjunction with @wormhole-foundation/sdk",
"files": [
"dist/esm",
"dist/cjs"
],
"keywords": [
"wormhole",
"sdk",
"typescript",
"connect",
"sui"
],
"engines": {
"node": ">=16"
},
"sideEffects": [
"./dist/cjs/index.js",
"./dist/esm/index.js"
],
"scripts": {
"build:cjs": "tsc -p ./tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
"build:esm": "tsc -p ./tsconfig.esm.json",
"build": "npm run build:esm && npm run build:cjs",
"rebuild": "npm run clean && npm run build",
"clean": "rm -rf ./dist && rm -rf ./.turbo",
"lint": "npm run prettier && eslint --fix ./src --ext .ts",
"prettier": "prettier --write ./src"
},
"dependencies": {
"@mysten/sui.js": "^0.50.1",
"@wormhole-foundation/sdk-connect": "0.10.9",
"@wormhole-foundation/sdk-sui": "0.10.9"
},
"type": "module",
"exports": {
".": {
"react-native": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
},
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
},
"default": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
}
}
}
31 changes: 31 additions & 0 deletions platforms/sui/protocols/cctp/src/circleBridge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { SuiBuildOutput, SuiChains, SuiUnsignedTransaction } from "@wormhole-foundation/sdk-sui";
import { AccountAddress, ChainAddress, CircleBridge, CircleTransferMessage, circle } from '@wormhole-foundation/sdk-connect';

export class SuiCircleBridge<N extends Network, C extends SuiChains>
implements CircleBridge<N, C> {

async *transfer(
sender: AccountAddress<C>,
recipient: ChainAddress,
amount: bigint,
): AsyncGenerator<SuiUnsignedTransaction<N, C>> {
/* TODO */
}

async isTransferCompleted(message: CircleBridge.Message): Promise<boolean> {
/* TODO */
return false;
}

async *redeem(
sender: AccountAddress<C>,
message: CircleBridge.Message,
attestation: string,
): AsyncGenerator<SuiUnsignedTransaction<N, C>> {
/* TODO */
}

async parseTransactionDetails(txid: string): Promise<CircleTransferMessage> {
/* TODO */
}
}
5 changes: 5 additions & 0 deletions platforms/sui/protocols/cctp/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { registerProtocol } from '@wormhole-foundation/sdk-connect';

import { _platform } from '@wormhole-foundation/sdk-solana';


8 changes: 8 additions & 0 deletions platforms/sui/protocols/cctp/tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../../../tsconfig.cjs.json",
"include": ["src"],
"compilerOptions": {
"outDir": "dist/cjs",
"rootDir": "src"
}
}
8 changes: 8 additions & 0 deletions platforms/sui/protocols/cctp/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../../../tsconfig.esm.json",
"include": ["src"],
"compilerOptions": {
"outDir": "dist/esm",
"rootDir": "src"
}
}
4 changes: 4 additions & 0 deletions platforms/sui/protocols/cctp/typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["../../../../typedoc.base.json"],
"entryPoints": ["src/index.ts"],
}

0 comments on commit 8449747

Please sign in to comment.