Sei Dapp Integration

Welcome to Ramper Wallet Extension Developer Guide. This documentation contains guides for developers to get started developing on Ramper Wallet Extension.‌

To detect Ramper Wallet Extension with Cosmos Base Chain

To detect whether your browser is running Ramper Extension, please use:

if (window.ramper2) {
  console.log('Ramper Extension is installed!');
}

To connect Ramper Wallet Extension

To connect Ramper Wallet Extension means to access the user's [blockchain - like Cosmos] account(s).

// Connect only
window.ramper2.cosmos.enable(chainId: string);
// Connect & get accounts
window.ramper2.cosmos.getKey(chainId: string);

Currently, chains support: ['atlantic-2','pacific-1']

To disconnect the Ramper Wallet Extension

To disconnect Ramper Extension, please use:

window.ramper2.cosmos.disconnect();

To experience functions

Once your account is connected, let's start experiencing more functions.‌

Get Current Account

If the webpage has permission and Ramper wallet is unlocked, this function will return the address and public key in the following format:

interface Key {
  name: string;
  algo: string;
  pubKey: Uint8Array;
  address: Uint8Array;
  bech32Address: string;
  isNanoLedger: boolean;
}

window.ramper2.cosmos.getKey(chainId: string): Promise<Key>

Sign Amino:

Like signAmino method of CosmJS OfflineDirectSigner, however, Ramper’s signAmino function takes the chain-id as a required parameter. Signs Proto-encoded StdSignDoc.

interface SignOptions {
 // If set to true the wallet will not override fees specified in the signDoc.
  preferNoSetFee: boolean
}  

window.ramper2.cosmos.signAmino(chainId: string, signer: string, signDoc: StdSignDoc, signOptions?: SignOptions)

Sign Direct:

Like signDirect method of CosmJS OfflineDirectSigner, however, Ramper’s signDirect function takes the chain-id as a required parameter. Signs Proto-encoded StdSignDoc.

interface SignDoc {
  bodyBytes?: Uint8Array | null;
  authInfoBytes?: Uint8Array | null;
  chainId?: string | null;
  accountNumber?: Long | null;
} 

window.ramper2.cosmos.signDirect(chainId: string, signer: string, signDoc: SignDoc)

Sign Arbitrary:

signArbitrary(
    chainId: string,
    signerAddress: string,
    data: string | Uint8Array
): Promise<StdSignature>;

 window.ramper2.cosmos.signArbitrary(chainId: string, signer: string, data: string)

Delegate Transaction broadcasting:

enum BroadcastMode {
  Sync = 'sync',
  Async = 'async',
  Block = 'block'
}

 window.ramper2.cosmos.sendTx(chainId: string, tx: Uint8Array, mode: BroadcastMode)

To handle events

List of events

Currently, we only support some action events from the wallet extension

connection.on('event_name', callback);
​//Example
window.ramper2.cosmos.on('cosmosChanged', () => window.location.reload());
window.ramper2.cosmos.on('accountsChanged', () => window.location.reload());

Last updated