Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "1.2.0",
"module": "src/index.ts",
"type": "module",
"scripts": {
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"@types/bun": "latest",
"@types/yargs": "^17.0.32"
Expand Down
22 changes: 19 additions & 3 deletions cli/src/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,24 @@ function isObject(obj: any): obj is Record<string, any> {
return obj && typeof obj === 'object' && !Array.isArray(obj);
}

export function diffObjects<T extends Record<string, any>>(obj1: T, obj2: T): Partial<DiffMap<T>> {
function isPathExcluded(path: string, excludedPaths: string[]): boolean {
return excludedPaths.includes(path);
}

export function diffObjects<T extends Record<string, any>>(obj1: T, obj2: T, excludedPaths: string[] = [], currentPath: string = ""): Partial<DiffMap<T>> {
const result: Partial<DiffMap<T>> = {};

for (const key in obj1) {
if (obj1.hasOwnProperty(key)) {
const keyPath = currentPath ? `${currentPath}.${key}` : key;

if (isPathExcluded(keyPath, excludedPaths)) {
continue; // Skip excluded paths
}

if (obj2.hasOwnProperty(key)) {
if (isObject(obj1[key]) && isObject(obj2[key])) {
result[key] = diffObjects(obj1[key], obj2[key]);
result[key] = diffObjects(obj1[key], obj2[key], excludedPaths, keyPath);
} else if (obj1[key] === obj2[key]) {
// result[key] = obj1[key] as any;
} else {
Expand All @@ -36,14 +46,20 @@ export function diffObjects<T extends Record<string, any>>(obj1: T, obj2: T): Pa

for (const key in obj2) {
if (obj2.hasOwnProperty(key) && !obj1.hasOwnProperty(key)) {
const keyPath = currentPath ? `${currentPath}.${key}` : key;

if (isPathExcluded(keyPath, excludedPaths)) {
continue; // Skip excluded paths
}

result[key] = { pull: obj2[key] } as any;
}
}

// prune empty objects
for (const key in result) {
if (isObject(result[key])) {
if (Object.keys(result[key]).length === 0) {
if (result[key] && Object.keys(result[key] as object).length === 0) {
delete result[key];
}
}
Expand Down
22 changes: 6 additions & 16 deletions cli/src/evmsigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,12 @@ export class EvmNativeSigner<N extends Network, C extends EvmChains = EvmChains>
feeData.maxPriorityFeePerGas ?? maxPriorityFeePerGas;
}

// Oasis throws malformed errors unless we
// set it to use legacy transaction parameters
const gasOpts =
chain === 'Oasis'
? {
gasLimit,
gasPrice: gasPrice,
// Hardcode type
type: 0,
}
: {
gasPrice,
maxFeePerGas,
maxPriorityFeePerGas,
gasLimit,
};
const gasOpts = {
gasPrice,
maxFeePerGas,
maxPriorityFeePerGas,
gasLimit,
};

// TODO: DIFF ENDS HERE

Expand Down
1 change: 1 addition & 0 deletions cli/src/getSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export async function getSigner<N extends Network, C extends Chain>(
}
privateKey = privateKeySource;
}
source = privateKey;
signer = await solana.getSigner(
await chain.getRpc(),
privateKey,
Expand Down
136 changes: 92 additions & 44 deletions cli/src/index.ts

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions cli/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Type declarations for Bun-specific imports

declare module "*.sol" {
const content: string;
export default content;
}
4 changes: 2 additions & 2 deletions cli/test/sepolia-bsc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ wait_for_rpc() {
local url=$1
local max_attempts=30
local attempt=1

echo "Waiting for RPC endpoint $url to be ready..."
while [ $attempt -le $max_attempts ]; do
if curl -s -X POST "$url" \
Expand Down Expand Up @@ -87,7 +87,7 @@ cat <<EOF > overrides.json
}
EOF

ntt add-chain Bsc --token 0x0B15635FCF5316EdFD2a9A0b0dC3700aeA4D09E6 --mode locking --skip-verify --latest
ntt add-chain Bsc --token 0x0B15635FCF5316EdFD2a9A0b0dC3700aeA4D09E6 --mode locking --skip-verify --latest --no-executor
ntt add-chain Sepolia --token 0xB82381A3fBD3FaFA77B3a7bE693342618240067b --skip-verify --ver 1.0.0

ntt pull --yes
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"rebuild": "npm run rebuild --workspaces --if-present",
"build:solana": "npm run build --workspace=sdk/definitions --workspace=solana",
"build:evm": "npm run build --workspace=sdk/definitions --workspace=sdk/evm",
"typecheck:cli": "npm run typecheck --workspace=cli",
"generate": "npm run generate --workspaces --if-present",
"test": "npm run test --workspaces --if-present",
"test:ci": "CI=true jest --config ./jest.config.ts",
Expand Down Expand Up @@ -36,4 +37,4 @@
"sdk/examples",
"cli"
]
}
}
Loading