-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/pro 615 task sdk implementation new (#176)
* Have added name resolution service to etherspot sdk * Resolve name has been added to sdk file * Updated graphql schema * Updated graphql schema * Have done the with QA and Prod environment and updated the necessary files * Install pacakages using node 14
- Loading branch information
1 parent
08549a6
commit 9944b64
Showing
25 changed files
with
396 additions
and
14,034 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Wallet } from 'ethers'; | ||
import { Env, EnvNames, NetworkNames, Sdk } from '../../src'; | ||
import { logger } from './common'; | ||
|
||
async function main(): Promise<void> { | ||
const wallet = Wallet.createRandom(); | ||
logger.log('wallet', wallet.address); | ||
|
||
const sdk = new Sdk(wallet, { env: EnvNames.MainNets, networkName: NetworkNames.Mainnet }); | ||
|
||
const ensTopLevelDomains = await sdk.getENSTopLevelDomains(); | ||
|
||
if (!ensTopLevelDomains.length) { | ||
logger.info('ens top level domain not found'); | ||
return; | ||
} | ||
|
||
logger.log( | ||
'contract account', | ||
await sdk.computeContractAccount({ | ||
sync: false, | ||
}), | ||
); | ||
|
||
const ensName = `random${Date.now().toString(16)}.${ensTopLevelDomains[0]}`; | ||
|
||
const ensNode = await sdk.reserveENSName({ | ||
name: ensName, | ||
}); | ||
|
||
logger.log('ens node', ensNode); | ||
|
||
// ens support | ||
logger.log( | ||
'resolve ens name', | ||
await sdk.resolveName({ | ||
chainId: 137, | ||
name: ensNode.name, | ||
}), | ||
); | ||
|
||
// unstoppable domains support | ||
logger.log( | ||
'resolve name of unstoppable domain', | ||
await sdk.resolveName({ | ||
name: 'brad.crypto', | ||
}), | ||
); | ||
|
||
// fio support | ||
logger.log( | ||
'resolve name of fio domain', | ||
await sdk.resolveName({ | ||
chainId: 137, // ChainId must be mapped with an entered domain name and it is supported by the platform too. | ||
name: 'purse@alice', // This is just a sample name. Please pass the correct domain with chaindID | ||
}), | ||
); | ||
} | ||
|
||
main() | ||
.catch(logger.error) | ||
.finally(() => process.exit()); |
Oops, something went wrong.