@avalabs/bridge-unified 0.0.0-hello-world-20230824162438 → 0.0.0-project-fusion-pr-20260112192135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/README.md +207 -4
- package/dist/index.cjs +38 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +388 -32
- package/dist/index.d.ts +388 -32
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +26 -10
- package/.turbo/turbo-build.log +0 -22
- package/.turbo/turbo-lint.log +0 -4
- package/CHANGELOG.md +0 -13
- package/src/errors/index.ts +0 -20
- package/src/handlers/check-for-pending-bridge-journey.ts +0 -20
- package/src/handlers/execute-bridge-journey-step.ts +0 -20
- package/src/handlers/plan-bridge-journey.ts +0 -25
- package/src/index.ts +0 -2
- package/src/unified-bridge-service.ts +0 -19
- package/tsconfig.json +0 -8
- package/tsup.config.ts +0 -4
package/package.json
CHANGED
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avalabs/bridge-unified",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"license": "Limited Ecosystem License",
|
|
4
|
+
"version": "0.0.0-project-fusion-pr-20260112192135",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"typings": "dist/index.d.ts",
|
|
5
8
|
"type": "module",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
6
12
|
"dependencies": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
13
|
+
"@noble/hashes": "1.5.0",
|
|
14
|
+
"@scure/base": "1.1.9",
|
|
15
|
+
"abitype": "0.9.3",
|
|
16
|
+
"lodash": "4.17.21",
|
|
17
|
+
"viem": "2.11.1",
|
|
18
|
+
"zod": "3.23.8",
|
|
19
|
+
"@scure/btc-signer": "1.3.2",
|
|
20
|
+
"coinselect": "3.1.13"
|
|
10
21
|
},
|
|
11
22
|
"devDependencies": {
|
|
23
|
+
"@types/jest": "29.5.7",
|
|
24
|
+
"@types/lodash": "4.14.201",
|
|
25
|
+
"jest": "29.7.0",
|
|
26
|
+
"ts-jest": "29.1.1",
|
|
12
27
|
"tsup": "7.2.0",
|
|
13
|
-
"
|
|
14
|
-
"eslint-config-custom": "0.
|
|
15
|
-
"@internal/bridge-shared": "0.0.0-hello-world-20230824162438",
|
|
16
|
-
"@internal/tsup-config": "0.0.0-hello-world-20230824162438"
|
|
28
|
+
"@internal/tsup-config": "0.0.1",
|
|
29
|
+
"eslint-config-custom": "0.1.0"
|
|
17
30
|
},
|
|
18
31
|
"scripts": {
|
|
19
32
|
"build": "tsup",
|
|
20
|
-
"
|
|
33
|
+
"build:watch": "tsup --watch",
|
|
34
|
+
"lint": "eslint \"src/**/*.ts\"",
|
|
35
|
+
"test": "jest",
|
|
36
|
+
"test:watch": "jest --watch"
|
|
21
37
|
}
|
|
22
38
|
}
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @avalabs/bridge-unified@1.0.1 build /home/runner/work/consumer-sdks/consumer-sdks/packages/bridge-unified
|
|
3
|
-
> tsup
|
|
4
|
-
|
|
5
|
-
[34mCLI[39m Building entry: ./src/index.ts
|
|
6
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v7.2.0
|
|
8
|
-
[34mCLI[39m Using tsup config: /home/runner/work/consumer-sdks/consumer-sdks/packages/bridge-unified/tsup.config.ts
|
|
9
|
-
[34mCLI[39m Target: es2021
|
|
10
|
-
[34mCLI[39m Cleaning output folder
|
|
11
|
-
[34mCJS[39m Build start
|
|
12
|
-
[34mESM[39m Build start
|
|
13
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m496.00 B[39m
|
|
14
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m4.71 KB[39m
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in 613ms
|
|
16
|
-
[32mESM[39m [1mdist/index.js [22m[32m484.00 B[39m
|
|
17
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m4.71 KB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in 613ms
|
|
19
|
-
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in 7120ms
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m1.25 KB[39m
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.25 KB[39m
|
package/.turbo/turbo-lint.log
DELETED
package/CHANGELOG.md
DELETED
package/src/errors/index.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export enum ErrorCode {
|
|
2
|
-
NOT_IMPLEMENTED = 5001,
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
class BridgeError extends Error {
|
|
6
|
-
constructor(
|
|
7
|
-
message: string,
|
|
8
|
-
public code: ErrorCode,
|
|
9
|
-
) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.code = code;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export class NotImplementedError extends BridgeError {
|
|
16
|
-
constructor(message = 'Not implemented') {
|
|
17
|
-
super(message, ErrorCode.NOT_IMPLEMENTED);
|
|
18
|
-
this.name = 'NotImplementedError';
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Address } from 'viem';
|
|
2
|
-
import { NotImplementedError } from '../errors';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Checks for any currently pending bridge transactions. Useful for dApps that want
|
|
6
|
-
* to display the current tx's status after a page refresh.
|
|
7
|
-
*/
|
|
8
|
-
export const checkForPendingBridgeJourney = async ({
|
|
9
|
-
address: _address,
|
|
10
|
-
chainIds: _chainIds,
|
|
11
|
-
}: {
|
|
12
|
-
address: Address;
|
|
13
|
-
chainIds: string[];
|
|
14
|
-
}) => {
|
|
15
|
-
/**
|
|
16
|
-
* 1. If wallet is Core, request current bridge journey. Otherwise, check glacier to see if the provided wallet has bridge tx in the past 100 transactions on the provided chains.
|
|
17
|
-
* 3. Returns an array of txIds for all pending transactions
|
|
18
|
-
*/
|
|
19
|
-
throw new NotImplementedError();
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { NotImplementedError } from '../errors';
|
|
2
|
-
|
|
3
|
-
type ExecuteBridgeJourneyStepParams = {
|
|
4
|
-
stepIndex: number;
|
|
5
|
-
journey: unknown;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const executeBridgeJourneyStep = async (_params: ExecuteBridgeJourneyStepParams) => {
|
|
9
|
-
/**
|
|
10
|
-
* 1. Validate the journey
|
|
11
|
-
* 3. Forward request along to the right bridge platform's package.
|
|
12
|
-
* 4. Return an observable that emits events when:
|
|
13
|
-
* - User signs the transaction (returns the fromChain txId)
|
|
14
|
-
* - Every block confirmation on fromChain
|
|
15
|
-
* - fromChain tx completed, starting the toChain tx (returns the toChainTxId)
|
|
16
|
-
* - Every block confirmation on toChain
|
|
17
|
-
* - toChain tx completed
|
|
18
|
-
*/
|
|
19
|
-
throw new NotImplementedError();
|
|
20
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { NotImplementedError } from '../errors';
|
|
2
|
-
import { BridgePlatform, type Token } from '@internal/bridge-shared';
|
|
3
|
-
|
|
4
|
-
type GetBridgeRouterParams = {
|
|
5
|
-
fromChainId: string;
|
|
6
|
-
toChainId: string;
|
|
7
|
-
fromToken: Token;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
type BridgeTransactionStep = {
|
|
11
|
-
fromChainId: string;
|
|
12
|
-
toChainId: string;
|
|
13
|
-
bridgePlatform: BridgePlatform;
|
|
14
|
-
fromToken: Token;
|
|
15
|
-
toToken: Token;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Returns a list of transaction steps needed to complete a bridge from chain A to B.
|
|
20
|
-
* The response may include multiple steps if the bridge requires multiple hops.
|
|
21
|
-
*/
|
|
22
|
-
export const planBridgeJourney = (_params: GetBridgeRouterParams): BridgeTransactionStep[] => {
|
|
23
|
-
// Implement smart logic for determining how to get the token from chain A to B
|
|
24
|
-
throw new NotImplementedError();
|
|
25
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { executeBridgeJourneyStep } from './handlers/execute-bridge-journey-step';
|
|
2
|
-
import { planBridgeJourney } from './handlers/plan-bridge-journey';
|
|
3
|
-
|
|
4
|
-
import type { Environment, MaybePromise, NativeToken } from '@internal/bridge-shared';
|
|
5
|
-
import { checkForPendingBridgeJourney } from './handlers/check-for-pending-bridge-journey';
|
|
6
|
-
|
|
7
|
-
export type BridgeServiceConfig = {
|
|
8
|
-
environment: `${Environment}`;
|
|
9
|
-
getChainNativeAsset: ({ evmChainId }: { evmChainId: string }) => MaybePromise<NativeToken>;
|
|
10
|
-
getChainErc20Asset: ({ evmChainId, address }: { evmChainId: string; address: string }) => MaybePromise<NativeToken>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const createUnifiedBridgeService = (_options: BridgeServiceConfig) => {
|
|
14
|
-
return {
|
|
15
|
-
planBridgeJourney,
|
|
16
|
-
executeBridgeJourneyStep,
|
|
17
|
-
checkForPendingBridgeJourney,
|
|
18
|
-
};
|
|
19
|
-
};
|
package/tsconfig.json
DELETED
package/tsup.config.ts
DELETED