Skip to content
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

Updated ENS Wrapper to use latest CLI and ethereum plugin #26

Merged
merged 1 commit into from
Apr 5, 2022
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
10 changes: 5 additions & 5 deletions ens/wrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@web3api/ens-api",
"description": "ENS Web3API",
"private": true,
"version": "0.0.1-prealpha.48",
"version": "0.0.1-prealpha.69",
"scripts": {
"build": "npx w3 build",
"test:env:up": "npx w3 test-env up",
Expand All @@ -15,13 +15,13 @@
"test:recipe": "npx w3 query ./recipes/e2e.json"
},
"dependencies": {
"@web3api/wasm-as": "0.0.1-prealpha.48"
"@web3api/wasm-as": "0.0.1-prealpha.69"
},
"devDependencies": {
"@types/jest": "22.2.3",
"@web3api/cli": "0.0.1-prealpha.48",
"@web3api/ethereum-plugin-js": "0.0.1-prealpha.48",
"@web3api/test-env-js": "0.0.1-prealpha.48",
"@web3api/cli": "0.0.1-prealpha.69",
"@web3api/ethereum-plugin-js": "0.0.1-prealpha.69",
"@web3api/test-env-js": "0.0.1-prealpha.69",
"dotenv": "8.2.0",
"ethers": "5.0.8",
"jest": "27.0.6",
Expand Down
28 changes: 14 additions & 14 deletions ens/wrapper/src/mutation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function setResolver(input: Input_setResolver): Ethereum_TxResponse {
},
});

return setResolverTx;
return setResolverTx.unwrap();
}

export function registerDomain(
Expand All @@ -68,7 +68,7 @@ export function registerDomain(
},
});

return tx;
return tx.unwrap();
}

export function setOwner(input: Input_setOwner): Ethereum_TxResponse {
Expand All @@ -88,7 +88,7 @@ export function setOwner(input: Input_setOwner): Ethereum_TxResponse {
},
});

return tx;
return tx.unwrap();
}

export function setSubdomainOwner(
Expand All @@ -115,7 +115,7 @@ export function setSubdomainOwner(
},
});

return tx;
return tx.unwrap();
}

export function setSubdomainRecord(
Expand Down Expand Up @@ -144,7 +144,7 @@ export function setSubdomainRecord(
},
});

return tx;
return tx.unwrap();
}

//TODO: Where could this be used on mainnet?
Expand All @@ -171,7 +171,7 @@ export function setRecord(input: Input_setRecord): Ethereum_TxResponse {
},
});

return tx;
return tx.unwrap();
}

export function setName(input: Input_setName): Ethereum_TxResponse {
Expand All @@ -191,7 +191,7 @@ export function setName(input: Input_setName): Ethereum_TxResponse {
},
});

return setNameTx;
return setNameTx.unwrap();
}

export function reverseRegisterDomain(
Expand Down Expand Up @@ -243,7 +243,7 @@ export function setAddress(input: Input_setAddress): Ethereum_TxResponse {
},
});

return setAddrTx;
return setAddrTx.unwrap();
}

export function setContentHash(
Expand All @@ -265,7 +265,7 @@ export function setContentHash(
},
});

return setContentHash;
return setContentHash.unwrap();
}

export function setAddressFromDomain(
Expand Down Expand Up @@ -293,7 +293,7 @@ export function setAddressFromDomain(
},
});

return setAddrTx;
return setAddrTx.unwrap();
}

export function setContentHashFromDomain(
Expand Down Expand Up @@ -321,7 +321,7 @@ export function setContentHashFromDomain(
},
});

return setContentHash;
return setContentHash.unwrap();
}

export function deployFIFSRegistrar(input: Input_deployFIFSRegistrar): string {
Expand All @@ -332,7 +332,7 @@ export function deployFIFSRegistrar(input: Input_deployFIFSRegistrar): string {
connection: input.connection,
});

return address;
return address.unwrap();
}

export function registerSubnodeOwnerWithFIFSRegistrar(
Expand All @@ -354,7 +354,7 @@ export function registerSubnodeOwnerWithFIFSRegistrar(
},
});

return txHash;
return txHash.unwrap();
}

export function setTextRecord(input: Input_setTextRecord): Ethereum_TxResponse {
Expand All @@ -374,7 +374,7 @@ export function setTextRecord(input: Input_setTextRecord): Ethereum_TxResponse {
},
});

return txHash;
return txHash.unwrap();
}

export function configureOpenDomain(
Expand Down
22 changes: 11 additions & 11 deletions ens/wrapper/src/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function getResolver(input: Input_getResolver): string {
connection: input.connection,
});

return resolverAddress;
return resolverAddress.unwrap();
}

export function getOwner(input: Input_getOwner): string {
Expand All @@ -35,7 +35,7 @@ export function getOwner(input: Input_getOwner): string {
connection: input.connection,
});

return owner;
return owner.unwrap();
}

export function getAddress(input: Input_getAddress): string {
Expand All @@ -46,7 +46,7 @@ export function getAddress(input: Input_getAddress): string {
connection: input.connection,
});

return address;
return address.unwrap();
}

export function getContentHash(input: Input_getContentHash): string {
Expand All @@ -57,7 +57,7 @@ export function getContentHash(input: Input_getContentHash): string {
connection: input.connection,
});

return hash;
return hash.unwrap();
}

export function getAddressFromDomain(
Expand All @@ -76,7 +76,7 @@ export function getAddressFromDomain(
connection: input.connection,
});

return address;
return address.unwrap();
}

export function getContentHashFromDomain(
Expand All @@ -95,7 +95,7 @@ export function getContentHashFromDomain(
connection: input.connection,
});

return hash;
return hash.unwrap();
}

export function getExpiryTimes(input: Input_getExpiryTimes): string {
Expand All @@ -109,7 +109,7 @@ export function getExpiryTimes(input: Input_getExpiryTimes): string {
connection: input.connection,
});

return expiryTime;
return expiryTime.unwrap();
}

export function getReverseResolver(input: Input_getReverseResolver): string {
Expand All @@ -122,7 +122,7 @@ export function getReverseResolver(input: Input_getReverseResolver): string {
connection: input.connection,
});

return resolverAddress;
return resolverAddress.unwrap();
}

export function getNameFromAddress(input: Input_getNameFromAddress): string {
Expand All @@ -141,7 +141,7 @@ export function getNameFromAddress(input: Input_getNameFromAddress): string {
connection: input.connection,
});

return name;
return name.unwrap();
}

export function getNameFromReverseResolver(
Expand All @@ -156,7 +156,7 @@ export function getNameFromReverseResolver(
connection: input.connection,
});

return name;
return name.unwrap();
}

export function getTextRecord(input: Input_getTextRecord): string {
Expand All @@ -167,5 +167,5 @@ export function getTextRecord(input: Input_getTextRecord): string {
connection: input.connection,
});

return value;
return value.unwrap();
}
8 changes: 4 additions & 4 deletions ens/wrapper/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export function namehash(inputName: string): string {
const labels: string[] = name.split('.');

for(let i = labels.length - 1; i >= 0; i--) {
let labelSha = SHA3_Query.keccak_256({ message: labels[i] })
node = SHA3_Query.hex_keccak_256({ message: node + labelSha })
let labelSha = SHA3_Query.keccak_256({ message: labels[i] }).unwrap()
node = SHA3_Query.hex_keccak_256({ message: node + labelSha }).unwrap()
}
}

Expand All @@ -24,9 +24,9 @@ export function namehash(inputName: string): string {
export function normalize(name: string): string {
return name ? UTS46_Query.toAscii({
value: name
}) : name
}).unwrap() : name
}

export function keccak256 (value: string): string {
return "0x" + SHA3_Query.keccak_256({ message: value })
return "0x" + SHA3_Query.keccak_256({ message: value }).unwrap()
}
Loading