Skip to content

Instantly share code, notes, and snippets.

View olehmell's full-sized avatar
🏠
Working from home

Oleh Mell olehmell

🏠
Working from home
View GitHub Profile
@olehmell
olehmell / IdentityIcon.tsx
Created February 22, 2023 11:30
Integrate Jdenticon to Antd Avatar component
import { IdentityProps } from '@polkadot/react-identicon/types'
import Avatar from 'antd/lib/avatar/avatar'
import React, {useEffect, useRef} from 'react'
import { DEFAULT_AVATAR_SIZE } from 'src/config/Size.config'
import * as jdenticon from 'jdenticon';
type JdenticonProps = {
value: string;
@olehmell
olehmell / subsocial-sdk-examples.ts
Last active October 22, 2021 13:56
Subsocial SDK Examples
import { newFlatSubsocialApi } from '@subsocial/api'
import { ReactionId } from '@subsocial/types/substrate/interfaces'
import { idToBn } from '@subsocial/utils'
const MY_ACCOUNT = '3omeLMCdtrojRPf7KyvTg78EvLxyJMo7mb2bqM28EEvxmXFM'
const config = {
substrateNodeUrl: 'wss://rpc.subsocial.network',
offchainUrl: 'https://app.subsocial/network/offchain',
ipfsNodeUrl: 'https://app.subsocial/network/ipfs'
@olehmell
olehmell / rpc-methods.txt
Last active November 27, 2020 11:21
Need methods for RPC
Spaces:
getSpaces
getSpacesByIds
getSpaceIds(maybe useless?)
getPublicSpaces
getUnlistedSpaces
Posts:
getPosts
@olehmell
olehmell / subsocial-pallet.rs
Created February 27, 2020 18:37
Subsocial-pallet in ryst and types.json for registry types on UI
#![cfg_attr(not(feature = "std"), no_std)]
/// For more guidance on FRAME pallets, see the example.
/// https://github.com/paritytech/substrate/blob/master/frame/example/src/lib.rs
pub mod defaults;
pub mod messages;
pub mod functions;
use sp_std::prelude::*;
class Api {
_res;
constructor (_baseUrl) {
this._baseUrl = _baseUrl;
this._xhr = new XMLHttpRequest();
this._xhr.onload = this._onload;
this._xhr.addEventListener( 'load', this._onSuccess );
}