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

UNS support #16

Merged
merged 1 commit into from
Oct 19, 2021
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ddns-action
DDNS(Distributed Domain Name System) update action. Currently it supports ENS and CNS.
DDNS(Distributed Domain Name System) update action. Currently it supports ENS, CNS and UNS.

<p align="center">
<img width="400" src="assets/ddns-action.png" alt="ddns action">
Expand All @@ -10,7 +10,7 @@ Parameter |Required |Description
--- |--- |---
`mnemonic` |Yes |Mnemonic phrase for wallet recovery. Plain PrivateKey can be used as well.
`rpc` |Yes |Url of RPC APIs.
`name` |Yes |Distributed domain name. Currently it supports ENS, CNS (.eth, .crypto) names. (eg `ddns-action.eth`, `ddns-action.crypto`)
`name` |Yes |Distributed domain name. Currently it supports ENS(.eth), CNS(.crypto), UNS(.coin, .wallet, .bitcoin, .x, .888, .nft, .dao, .blockchain) names. (eg `ddns-action.eth`, `ddns-action.crypto`)
`contentHash` |Yes |Hash of content..
`contentType` |No |Type of content. Supported types [`ipfs-ns`, `swarm-ns`]. Default `ipfs-ns`
`dryRun` |No |Execution emulation without setting new content hash. Default `false`
Expand All @@ -21,6 +21,7 @@ Provider |ipfs-ns |swarm-ns
--- |--- |---
ENS |Yes |Yes
CNS |Yes |No
UNS |Yes |No

## Example usage

Expand Down
4 changes: 2 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Update DDNS'
description: 'DDNS(Distributed Domain Name System) update action. Currently it supports ENS and CNS.'
description: 'DDNS(Distributed Domain Name System) update action. Currently it supports ENS, CNS and UNS.'
branding:
icon: 'edit'
color: 'green'
Expand All @@ -11,7 +11,7 @@ inputs:
description: 'Url of RPC APIs.'
required: true
name:
description: 'Distributed domain name. Currently it supports ENS, CNS (.eth, .crypto) names. (eg `ddns-action.eth`)'
description: 'Distributed domain name. Currently it supports ENS(.eth), CNS(.crypto), UNS(.coin, .wallet, .bitcoin, .x, .888, .nft, .dao, .blockchain) names. (eg `ddns-action.eth`)'
required: true
contentHash:
description: 'Hash of content.'
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"keywords": [
"ENS",
"UNS",
"CNS",
"DDNS",
"GitHub",
Expand Down
8 changes: 4 additions & 4 deletions src/updater/cns/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const { ethers } = require('ethers');
const NetworkConfig = require('uns/uns-config.json');
const CNSRegistryABI = require('uns/artifacts/abi/CNSRegistry.json');
const ResolverABI = require('uns/artifacts/abi/Resolver.json');

const registryABI = require('./registry.json');
const resolverABI = require('./resolver.json');
const { namehash } = require('../../utils/namehash');

const ipfsKey = 'ipfs.html.value';
Expand All @@ -16,7 +16,7 @@ function CNS(options) {
const { chainId } = await provider.getNetwork();
const { contracts } = NetworkConfig.networks[chainId];
const { address } = contracts.CNSRegistry;
const registryContract = new ethers.Contract(address, registryABI, provider);
const registryContract = new ethers.Contract(address, CNSRegistryABI, provider);
return registryContract.resolverOf(tokenId);
}

Expand All @@ -31,7 +31,7 @@ function CNS(options) {
throw new Error('Resolver not found');
}

return new ethers.Contract(resolver, resolverABI, provider);
return new ethers.Contract(resolver, ResolverABI, provider);
}

this.getContenthash = async () => {
Expand Down
Loading