Skip to content

Instantly share code, notes, and snippets.

import fs from 'fs';
const fsPromises = fs.promises;
export const getOrCreateNdjosnLogFile = async <T>(path: string) => {
let response: T[] = [];
if (fs.existsSync(path)) {
const rawResponse = fs.readFileSync(path, 'utf-8');
if (rawResponse.length !== 0) {
response = rawResponse
import { graphqlRmrkIndexer } from 'lib/graphql/graphql-client';
export const getPlotByIdQuery = graphqlRmrkIndexer(
`
query GetPlotByIdData($plotId: String!) {
nftById(id: $plotId) {
...NftFragment
}
}
`,
import { mapTxErrorNameToErrorMessage } from './map-tx-error-name-to-error-message';
import { Abi } from 'abitype';
import {
AbiErrorSignatureNotFoundError,
BaseError,
ContractFunctionExecutionError,
ContractFunctionExecutionErrorType,
ContractFunctionRevertedError,
SimulateContractErrorType,
WaitForTransactionReceiptErrorType,
type Props = {
collectionId: EthereumAddress;
onSuccess?: (data: TransactionReceipt) => void;
onSettled?: (data?: TransactionReceipt) => void;
onError?: (error?: Error) => void;
network?: EVM_NETWORKS;
newOwner: EthereumAddress;
enabled?: boolean;
};
const snapshot = [
{ buyer: '0xdaf780714Ce4931f98129060445fC6Eb4Ab73bB1', price: '11' }
{ buyer: '0xdd3c0f408Cad52Ca1224cb52b97DaEa58b443fc1', price: '5' }
{ buyer: '0x7E884E885AC2Ec3241FeF4B560f7d1Aaedcc0E50', price: '9' }
{ buyer: '0x2ef04E03457C96BfDeD0a85a772013937301C1CC', price: '1' }
{ buyer: '0x47bFF18E462912Ab61a465b2bc229e3857491AA6', price: '25' }
{ buyer: '0x24A566a73F252C2ea9E9BAC5b6873CF3BA03f232', price: '15' }
{ buyer: '0x24A566a73F252C2ea9E9BAC5b6873CF3BA03f232', price: '15' }
{ buyer: '0xb4cE0c954bB129D8039230F701bb6503dca1Ee8c', price: '50' }
{ buyer: '0xC22d43928CDBd57b6725E669C1606B18a2bcE82A', price: '4' }

Linking my account Yuripetusko on GitHub with my address 5Cafn1kueAGQnrcvN2uHFQ5NaMznSMyrfeUzuDHDQsMRSsN6 on Substrate in mycryptoprofile.io, and the challenge code is: aea52155756bc58fe228f0db8e9c4ef3. #LitentryVerifyMyAddress

@Yuripetusko
Yuripetusko / snapshot.js
Last active June 16, 2022 23:55 — forked from stevyhacker/snapshot.js
NFT holders snapshot tool
import fetch from 'node-fetch';
import fs from 'fs';
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
const apiKey = "INSERT_YOUR_OWN_API_KEY_HERE"
import { SubmittableExtrinsic } from '@polkadot/api/types';
import { ISubmittableResult } from '@polkadot/types/types';
import { KeyringPair } from '@polkadot/keyring/types';
import { getApi } from './get-polkadot-api-with-retry.ts';
import { CodecHash, EventRecord } from '@polkadot/types/interfaces';
const MAX_RETRIES = 5;
const RETRY_DELAY_SECONDS = 4;
export const sleep = (ms: number): Promise<void> => {
@Yuripetusko
Yuripetusko / get-polkadot-api-with-retry.ts
Last active April 11, 2022 20:11
If ws provider fails, recheck it's status up to 5 times, before reconnecting with a different ws endpoint
import { ApiPromise, WsProvider } from '@polkadot/api';
const WS_ENDPOINTS = [
'wss://kusama-rpc.polkadot.io',
'wss://kusama.api.onfinality.io/public-ws',
'wss://kusama-rpc.dwellir.com'
];
export const sleep = (ms: number): Promise<void> => {
return new Promise((resolve) => {
const util = require('util');
module.exports = (app, addon) => {
app.get('/', (req, res) => {
res.format({
'text/html': () => {
res.redirect('/atlassian-connect.json');
},
'application/json': () => {
res.redirect('/atlassian-connect.json');