Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { log } from '@lit-protocol/misc';
import { TinnyEnvironment } from 'local-tests/setup/tinny-environment';
import { api } from '@lit-protocol/wrapped-keys';
import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs';
import nacl from 'tweetnacl';
import bs58 from 'bs58';
import { Keypair } from '@solana/web3.js';
import { ethers } from 'ethers';
import nacl from 'tweetnacl';

const { generatePrivateKey, signMessageWithEncryptedKey, exportPrivateKey } =
api;
Expand Down Expand Up @@ -68,8 +68,8 @@ export const testGenerateSolanaWrappedKey = async (

const signatureIsValidForPublicKey = nacl.sign.detached.verify(
Buffer.from(messageToSign),
bs58.decode(signature),
bs58.decode(generatedPublicKey)
ethers.utils.base58.decode(signature),
ethers.utils.base58.decode(generatedPublicKey)
);

if (!signatureIsValidForPublicKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { log } from '@lit-protocol/misc';
import { TinnyEnvironment } from 'local-tests/setup/tinny-environment';
import { api } from '@lit-protocol/wrapped-keys';
import { Keypair } from '@solana/web3.js';
import bs58 from 'bs58';
import { ethers } from 'ethers';
import nacl from 'tweetnacl';
import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs';

Expand Down Expand Up @@ -68,7 +68,7 @@ export const testSignMessageWithSolanaEncryptedKey = async (

const signatureIsValidForPublicKey = nacl.sign.detached.verify(
Buffer.from(messageToSign),
bs58.decode(signature),
ethers.utils.base58.decode(signature),
solanaKeypair.publicKey.toBuffer()
);

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"@dotenvx/dotenvx": "^1.6.4",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@lit-protocol/contracts": "^0.0.63",
"@lit-protocol/accs-schemas": "^0.0.12",
"@lit-protocol/contracts": "^0.0.63",
"@metamask/eth-sig-util": "5.0.2",
"@mysten/sui.js": "^0.37.1",
"@openagenda/verror": "^3.1.4",
Expand All @@ -57,7 +57,6 @@
"ajv": "^8.12.0",
"base64url": "^3.0.1",
"bech32": "^2.0.0",
"bs58": "^5.0.0",
"cbor-web": "^9.0.2",
"cross-fetch": "3.1.8",
"date-and-time": "^2.4.1",
Expand Down Expand Up @@ -98,11 +97,11 @@
"buffer": "^6.0.3",
"chalk": "^5.3.0",
"cypress": "11.0.1",
"esbuild-node-externals": "^1.14.0",
"cypress-metamask": "^1.0.5-development",
"cypress-metamask-v2": "^1.7.2",
"esbuild": "^0.17.3",
"esbuild-node-builtins": "^0.1.0",
"esbuild-node-externals": "^1.14.0",
"esbuild-plugin-tsc": "^0.4.0",
"eslint": "8.48.0",
"eslint-config-next": "12.2.3",
Expand Down
1 change: 0 additions & 1 deletion packages/contracts-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"directory": "../../dist/packages/contracts-sdk"
},
"peerDependencies": {
"bs58": "^5.0.0",
"date-and-time": "^2.4.1",
"multiformats": "^9.7.1"
},
Expand Down
7 changes: 4 additions & 3 deletions packages/contracts-sdk/src/lib/contracts-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
MintWithAuthParams,
MintWithAuthResponse,
} from '@lit-protocol/types';
import bs58 from 'bs58';
import { BigNumberish, BytesLike, ContractReceipt, ethers } from 'ethers';
import { decToHex, hexToDec, intToIP } from './hex2dec';

Expand Down Expand Up @@ -1708,7 +1707,7 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope
* @returns {string}
*/
getBytesFromMultihash: (multihash: string) => {
const decoded = bs58.decode(multihash);
const decoded = ethers.utils.base58.decode(multihash);

return `0x${Buffer.from(decoded).toString('hex')}`;
},
Expand All @@ -1726,7 +1725,9 @@ https://developer.litprotocol.com/v3/sdk/wallets/auth-methods/#auth-method-scope
const digestSize = parseInt(text.slice(2, 4), 16);
const digest = text.slice(4, 4 + digestSize * 2);

const multihash = bs58.encode(Buffer.from(`1220${digest}`, 'hex'));
const multihash = ethers.utils.base58.encode(
Buffer.from(`1220${digest}`, 'hex')
);

return multihash;
},
Expand Down
3 changes: 1 addition & 2 deletions packages/misc/src/lib/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
} from '@lit-protocol/constants';
import { TokenInfo } from '@lit-protocol/types';
import { bech32 } from 'bech32';
import bs58 from 'bs58';
import { createHash } from 'crypto';
import { Contract, ethers } from 'ethers';
import { computeAddress } from 'ethers/lib/utils';
Expand Down Expand Up @@ -112,7 +111,7 @@ function deriveBitcoinAddress(ethPubKey: string): string {
const binaryBitcoinAddress = Buffer.concat([versionedPayload, checksum]);

// Encode the result with Base58 to get the final Bitcoin address and return it
return bs58.encode(binaryBitcoinAddress);
return ethers.utils.base58.encode(binaryBitcoinAddress);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/pkp-sui/src/lib/TransactionBlockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { hashTypedData } from './hash';
import bs58 from 'bs58';
import { ethers } from 'ethers';

/**
* Generate transaction digest.
Expand All @@ -12,5 +12,5 @@ import bs58 from 'bs58';
*/
export function getDigestFromBytes(bytes: Uint8Array) {
const hash = hashTypedData('TransactionData', bytes);
return bs58.encode(hash);
return ethers.utils.base58.encode(hash);
}
Loading
Loading