@ceramicnetwork/blockchain-utils-linking
Advanced tools
Comparing version 1.0.2 to 1.0.3-rc.0
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.0.3-rc.0](/compare/@ceramicnetwork/blockchain-utils-linking@1.0.2...@ceramicnetwork/blockchain-utils-linking@1.0.3-rc.0) (2021-07-16) | ||
**Note:** Version bump only for package @ceramicnetwork/blockchain-utils-linking | ||
## [1.0.2](/compare/@ceramicnetwork/blockchain-utils-linking@1.0.1...@ceramicnetwork/blockchain-utils-linking@1.0.2) (2021-05-25) | ||
@@ -8,0 +16,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { LinkProof } from "./util"; | ||
import { AccountID } from "caip"; | ||
import { LinkProof } from './util'; | ||
import { AccountID } from 'caip'; | ||
export interface AuthProvider { | ||
@@ -4,0 +4,0 @@ readonly isAuthProvider: true; |
@@ -1,4 +0,4 @@ | ||
import { AuthProvider } from "./auth-provider"; | ||
import { AccountID } from "caip"; | ||
import { LinkProof } from "./util"; | ||
import { AuthProvider } from './auth-provider'; | ||
import { AccountID } from 'caip'; | ||
import { LinkProof } from './util'; | ||
export declare class EosioAuthProvider implements AuthProvider { | ||
@@ -5,0 +5,0 @@ private readonly provider; |
@@ -55,3 +55,3 @@ "use strict"; | ||
version: 1, | ||
type: "eosio", | ||
type: 'eosio', | ||
message: consentMessage.message, | ||
@@ -72,5 +72,3 @@ signature: signedPayload, | ||
function sanitize(str, size) { | ||
return str | ||
.replace(/\s/g, " ") | ||
.replace(new RegExp(`(\\S{${size}})`, "g"), "$1 "); | ||
return str.replace(/\s/g, ' ').replace(new RegExp(`(\\S{${size}})`, 'g'), '$1 '); | ||
} | ||
@@ -77,0 +75,0 @@ function toPayload(message, accountID) { |
@@ -1,4 +0,4 @@ | ||
import { AuthProvider } from "./auth-provider"; | ||
import { AccountID } from "caip"; | ||
import { LinkProof } from "./util"; | ||
import { AuthProvider } from './auth-provider'; | ||
import { AccountID } from 'caip'; | ||
import { LinkProof } from './util'; | ||
declare type EthProviderOpts = { | ||
@@ -5,0 +5,0 @@ eoaSignAccount?: string; |
@@ -28,6 +28,6 @@ "use strict"; | ||
const ADDRESS_TYPES = { | ||
ethereumEOA: "ethereum-eoa", | ||
erc1271: "erc1271", | ||
ethereumEOA: 'ethereum-eoa', | ||
erc1271: 'erc1271', | ||
}; | ||
const CHAIN_NAMESPACE = "eip155"; | ||
const CHAIN_NAMESPACE = 'eip155'; | ||
class EthereumAuthProvider { | ||
@@ -41,3 +41,3 @@ constructor(provider, address, opts = {}) { | ||
async accountId() { | ||
const payload = util_1.encodeRpcMessage("eth_chainId", []); | ||
const payload = util_1.encodeRpcMessage('eth_chainId', []); | ||
const chainIdHex = await safeSend(payload, this.provider); | ||
@@ -68,3 +68,3 @@ const chainId = parseInt(chainIdHex, 16); | ||
async function getCode(address, provider) { | ||
const payload = util_1.encodeRpcMessage("eth_getCode", [address, "latest"]); | ||
const payload = util_1.encodeRpcMessage('eth_getCode', [address, 'latest']); | ||
return safeSend(payload, provider); | ||
@@ -87,3 +87,3 @@ } | ||
const bytecode = await getCode(account.address, provider).catch(() => null); | ||
return Boolean(bytecode && bytecode !== "0x" && bytecode !== "0x0" && bytecode !== "0x00"); | ||
return Boolean(bytecode && bytecode !== '0x' && bytecode !== '0x0' && bytecode !== '0x00'); | ||
} | ||
@@ -98,4 +98,4 @@ exports.isERC1271 = isERC1271; | ||
const bytes = uint8arrays.fromString(message); | ||
const hex = uint8arrays.toString(bytes, "base16"); | ||
return "0x" + hex; | ||
const hex = uint8arrays.toString(bytes, 'base16'); | ||
return '0x' + hex; | ||
} | ||
@@ -105,6 +105,3 @@ async function createEthLink(did, account, provider, opts = {}) { | ||
const hexMessage = utf8toHex(message); | ||
const payload = util_1.encodeRpcMessage("personal_sign", [ | ||
hexMessage, | ||
account.address, | ||
]); | ||
const payload = util_1.encodeRpcMessage('personal_sign', [hexMessage, account.address]); | ||
const signature = await safeSend(payload, provider); | ||
@@ -123,3 +120,3 @@ const proof = { | ||
async function validateChainId(account, provider) { | ||
const payload = util_1.encodeRpcMessage("eth_chainId", []); | ||
const payload = util_1.encodeRpcMessage('eth_chainId', []); | ||
const chainIdHex = await safeSend(payload, provider); | ||
@@ -156,6 +153,3 @@ const chainId = parseInt(chainIdHex, 16); | ||
const hexMessage = utf8toHex(message); | ||
const payload = util_1.encodeRpcMessage("personal_sign", [ | ||
hexMessage, | ||
account.address, | ||
]); | ||
const payload = util_1.encodeRpcMessage('personal_sign', [hexMessage, account.address]); | ||
const signature = await safeSend(payload, provider); | ||
@@ -162,0 +156,0 @@ const signatureBytes = uint8arrays.fromString(signature.slice(2)); |
@@ -1,5 +0,5 @@ | ||
import { AuthProvider } from "./auth-provider"; | ||
import { AccountID } from "caip"; | ||
import { LinkProof } from "./util"; | ||
import type { MessageParams } from "@zondax/filecoin-signing-tools"; | ||
import { AuthProvider } from './auth-provider'; | ||
import { AccountID } from 'caip'; | ||
import { LinkProof } from './util'; | ||
import type { MessageParams } from '@zondax/filecoin-signing-tools'; | ||
export declare class FilecoinAuthProvider implements AuthProvider { | ||
@@ -6,0 +6,0 @@ private readonly provider; |
@@ -49,3 +49,3 @@ "use strict"; | ||
version: 2, | ||
type: "eoa-tx", | ||
type: 'eoa-tx', | ||
message: message, | ||
@@ -63,14 +63,14 @@ signature: signatureResponse.Signature.Data, | ||
function asTransaction(address, message) { | ||
const messageParams = uint8arrays.toString(uint8arrays.fromString(message), "base64"); | ||
const messageParams = uint8arrays.toString(uint8arrays.fromString(message), 'base64'); | ||
return { | ||
From: address, | ||
To: address, | ||
Value: "0", | ||
Value: '0', | ||
Method: 0, | ||
GasPrice: "1", | ||
GasPrice: '1', | ||
GasLimit: 1000, | ||
Nonce: 0, | ||
Params: messageParams, | ||
GasFeeCap: "1", | ||
GasPremium: "1", | ||
GasFeeCap: '1', | ||
GasPremium: '1', | ||
}; | ||
@@ -77,0 +77,0 @@ } |
@@ -1,15 +0,15 @@ | ||
export * from "./auth-provider"; | ||
export * as ethereum from "./ethereum"; | ||
export * from "./util"; | ||
export * as filecoin from "./filecoin"; | ||
export * as polkadot from "./polkadot"; | ||
export * as eosio from "./eosio"; | ||
export * as cosmos from "./cosmos"; | ||
export { EthereumAuthProvider } from "./ethereum"; | ||
export { EthereumAuthProvider as AvalancheAuthProvider } from "./ethereum"; | ||
export { FilecoinAuthProvider } from "./filecoin"; | ||
export { EosioAuthProvider } from "./eosio"; | ||
export { PolkadotAuthProvider } from "./polkadot"; | ||
export { CosmosAuthProvider } from "./cosmos"; | ||
export { NearAuthProvider } from "./near"; | ||
export * from './auth-provider'; | ||
export * as ethereum from './ethereum'; | ||
export * from './util'; | ||
export * as filecoin from './filecoin'; | ||
export * as polkadot from './polkadot'; | ||
export * as eosio from './eosio'; | ||
export * as cosmos from './cosmos'; | ||
export { EthereumAuthProvider } from './ethereum'; | ||
export { EthereumAuthProvider as AvalancheAuthProvider } from './ethereum'; | ||
export { FilecoinAuthProvider } from './filecoin'; | ||
export { EosioAuthProvider } from './eosio'; | ||
export { PolkadotAuthProvider } from './polkadot'; | ||
export { CosmosAuthProvider } from './cosmos'; | ||
export { NearAuthProvider } from './near'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import { AccountID } from "caip"; | ||
import { AuthProvider } from "./auth-provider"; | ||
import { LinkProof } from "./util"; | ||
import { AccountID } from 'caip'; | ||
import { AuthProvider } from './auth-provider'; | ||
import { LinkProof } from './util'; | ||
export declare class PolkadotAuthProvider implements AuthProvider { | ||
@@ -5,0 +5,0 @@ private readonly provider; |
@@ -26,4 +26,4 @@ "use strict"; | ||
const uint8arrays = __importStar(require("uint8arrays")); | ||
const stringHex = (str) => `0x${uint8arrays.toString(uint8arrays.fromString(str), "base16")}`; | ||
const CHAIN_ID = "polkadot:b0a8d493285c2df73290dfb7e61f870f"; | ||
const stringHex = (str) => `0x${uint8arrays.toString(uint8arrays.fromString(str), 'base16')}`; | ||
const CHAIN_ID = 'polkadot:b0a8d493285c2df73290dfb7e61f870f'; | ||
class PolkadotAuthProvider { | ||
@@ -45,7 +45,7 @@ constructor(provider, address) { | ||
data: linkMessageHex, | ||
type: "bytes", | ||
type: 'bytes', | ||
}); | ||
return { | ||
version: 2, | ||
type: "eoa", | ||
type: 'eoa', | ||
message: linkMessageHex, | ||
@@ -52,0 +52,0 @@ signature: res.signature, |
@@ -6,7 +6,7 @@ "use strict"; | ||
const res = { | ||
message: "Link this account to your identity" + "\n\n" + did, | ||
message: 'Link this account to your identity' + '\n\n' + did, | ||
}; | ||
if (addTimestamp) { | ||
res.timestamp = Math.floor(Date.now() / 1000); | ||
res.message += " \n" + "Timestamp: " + res.timestamp; | ||
res.message += ' \n' + 'Timestamp: ' + res.timestamp; | ||
} | ||
@@ -18,3 +18,3 @@ return res; | ||
return { | ||
jsonrpc: "2.0", | ||
jsonrpc: '2.0', | ||
id: 1, | ||
@@ -21,0 +21,0 @@ method, |
{ | ||
"name": "@ceramicnetwork/blockchain-utils-linking", | ||
"version": "1.0.2", | ||
"version": "1.0.3-rc.0", | ||
"description": "Blockchain utils for linking blockchain accounts to DID", | ||
@@ -52,3 +52,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "b50fd9d09f670d870e365821c309b23c10fe7818" | ||
"gitHead": "96da1ec80824d70b03cd4c199560c207f401f5f1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
62101
762
1