Skip to content

Commit

Permalink
update: space id doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jincan39 committed Jan 31, 2024
1 parent 0796e6e commit 8e3cdc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 40 deletions.
46 changes: 7 additions & 39 deletions docs/manta-pacific/Space ID.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,12 @@ You can get address from domain name with a single request:

```javascript
const address = await web3name.getAddress("manta.manta");
// expect: '0xb5932a6b7d50a966aec6c74c97385412fb497540'

const address = await web3name.getAddress("bts_official.lens");
// expect: '0xd80efa68b50d21e548b9cdb092ebc6e5bca113e7'

const address = await web3name.getAddress("beresnev.crypto");
// expect: '0x6ec0deed30605bcd19342f3c30201db263291589'

const address = await web3name.getAddress("registry.gno");
// expect: '0x2886D6792503e04b19640C1f1430d23219AF177F'
const address = await web3name.getAddress("registry.manta");
```

### Multichain address resolution
Expand All @@ -72,10 +68,9 @@ Domain resolution for other chains can be provided by adding coinType param to g

```javascript
import { convertEVMChainIdToCoinType } from "@ensdomains/address-encoder";
const address = await web3name.getAddress("gnome.gno", {
const address = await web3name.getAddress("gnome.manta", {
coinType: convertEVMChainIdToCoinType(1),
});
// expect: 0x4348d45967552d0176d465170b7375ed22dc627b
```

## 3. Resolve an address
Expand All @@ -85,23 +80,21 @@ There are optional parameters in the method to select your target chain or TLD (
By providing chain IDs, you can resolve addresses on selected chains and get an available domain name from all TLDs deployed on these chains.

```javascript
// Resolve an address from Gnosis Chiado
// Resolve an address from Manta Pacific
const name = await web3name.getDomainName({
address: "0x2886D6792503e04b19640C1f1430d23219AF177F",
queryChainIdList: [10200],
queryChainIdList: [169],
});
// expect: lydia.gno
```

By providing TLDs, address can be resolved from the selected TLDs and get an available TLD primary name.

```javascript
// Resolve an address from .gno TLD
// Resolve an address from .manta TLD
const name = await web3name.getDomainName({
address: "0x2886D6792503e04b19640C1f1430d23219AF177F",
queryTldList: ["gno"],
queryTldList: ["manta"],
});
// expect: genome.gno
```

## 4. Record
Expand All @@ -121,30 +114,5 @@ Domain metadata can be fetched by SDK directly.

```javascript
// requesting
const metadata = await web3Name.getMetadata({ name: "public.gno" });
```

# Use your own RPC

We are using popular public RPC services by default to make it easier to use. But in some cases developers may prefer to use arbitrary RPC, so we provide optional parameter `rpcUrl` for each function that allows developers to use their own RPC to make requests.
For example, you can put custom rpcUrl as a parameter in `getAddress` function.

For example, you can put custom rpcUrl as a parameter in getAddress function.

```javascript
// Use custom RPC url (https://arb1.arbitrum.io/rpc)
const address = await web3name.getAddress("registry.arb", {
rpcUrl: "https://arb1.arbitrum.io/rpc",
});
// expect: '0x8d27d6235d9d8EFc9Eef0505e745dB67D5cD2918'
```

For other functions, it's also possible to have a custom `rpcUrl` in the request.

```javascript
// Use custom RPC url (https://arb1.arbitrum.io/rpc)
const address = await web3name.getMetaData("registry.arb", {
rpcUrl: "https://arb1.arbitrum.io/rpc",
});
// expect: '0x8d27d6235d9d8EFc9Eef0505e745dB67D5cD2918'
const metadata = await web3Name.getMetadata({ name: "public.manta" });
```
2 changes: 1 addition & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ module.exports = {
},
{
type: "doc",
label: "Space ID Name Service",
label: "SPACE ID Name Service and SPACE ID",
id: "manta-pacific/Space ID",
},
],
Expand Down

0 comments on commit 8e3cdc7

Please sign in to comment.