Skip to content

Instantly share code, notes, and snippets.

@nxt3d
nxt3d / resolveAddressFromContractXAP.js
Last active March 29, 2023 15:54
Resolve XAP names
import { config } from 'dotenv';
import { ethers } from 'ethers';
import axios from 'axios';
config();
// Goerli XAP resolver contract address
const contractAddr = "0x520497595f742426708dfbDcaB9D0D7D8555D937"
@nxt3d
nxt3d / FunctionSelector
Created March 29, 2023 01:36
Generate a function selector. (can be cut and pasted into Remix)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
contract FunctionSelector {
/*
"transfer(address,uint256)"
0xa9059cbb
"transferFrom(address,address,uint256)"
0x23b872dd
@nxt3d
nxt3d / NameEncoder
Created March 28, 2023 23:42
Solidity code to get the name hash of any ens name (It can be used in Remix).
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract NameEncoder {
using BytesUtils for bytes;
function dnsEncodeName(
string memory name
) public pure returns (bytes memory dnsName, bytes32 node) {
uint8 labelLength = 0;