Skip to content

Commit

Permalink
feat: add Leather to WBIP004 array, closes #5615
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie authored and markmhendrickson committed Jul 8, 2024
1 parent 7728eeb commit e38f6ab
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {

import { gaiaUrl as gaiaHubUrl } from '@shared/constants';

// This function repliactes behaviour wrapped in the `restoreWalletAccounts`
// This function replicates behaviour wrapped in the `restoreWalletAccounts`
// method of wallet-sdk. It checks for BNS names on Gaia-persisted accounts,
// resulting in a huge number of requests when called by a wallet with many
// accounts. Here, we only care to find the number of accounts a user has
Expand Down
38 changes: 38 additions & 0 deletions src/inpage/add-leather-to-providers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
interface WalletProvider {
id: string;
name: string;
icon: string;
webUrl?: string;
chromeWebStoreUrl?: string;
mozillaAddOnsUrl?: string;
googlePlayStoreUrl?: string;
iOSAppStoreUrl?: string;
methods?: string[];
}

// https://wbips.netlify.app/wbips/WBIP004
export function addLeatherToProviders() {
const win = window as unknown as Window & { btc_providers?: WalletProvider[] };

if (!win.btc_providers) win.btc_providers = [];

win.btc_providers.push({
id: 'LeatherProvider',
name: 'Leather',
icon: 'data:image/svg;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iMjYuODM4NyIgZmlsbD0iIzEyMTAwRiIvPgo8cGF0aCBkPSJNNzQuOTE3MSA1Mi43MTE0QzgyLjQ3NjYgNTEuNTQwOCA5My40MDg3IDQzLjU4MDQgOTMuNDA4NyAzNy4zNzYxQzkzLjQwODcgMzUuNTAzMSA5MS44OTY4IDM0LjIxNTQg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A3OS4yODQ4SDEwMi44MjlaIiBmaWxsPSIjRjdGNUYzIi8+Cjwvc3ZnPgo=',

webUrl: 'https://leather.io',

chromeWebStoreUrl:
'https://chromewebstore.google.com/detail/leather/ldinpeekobnhjjdofggfgjlcehhmanlj',

methods: [
'getAddresses',
'signMessage',
'sentTransfer',
'signPsbt',
'stx_signMessage',
'stx_signTransaction',
],
});
}
4 changes: 4 additions & 0 deletions src/inpage/inpage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ import {
} from '@shared/message-types';
import type { WalletMethodMap, WalletMethodNames, WalletResponses } from '@shared/rpc/rpc-methods';

import { addLeatherToProviders } from './add-leather-to-providers';

type CallableMethods = keyof typeof ExternalMethods;

addLeatherToProviders();

interface ExtensionResponse {
source: 'blockstack-extension';
method: CallableMethods;
Expand Down

0 comments on commit e38f6ab

Please sign in to comment.