@aragon/connect-core
Advanced tools
Comparing version 0.6.0 to 0.7.0-beta.1
@@ -1,2 +0,2 @@ | ||
import { AppFilters, Network, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { Address, AppFilters, Network, SubscriptionCallback, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { ConnectionContext } from '../types'; | ||
@@ -23,14 +23,14 @@ import IOrganizationConnector from './IOrganizationConnector'; | ||
permissionsForOrg(): Promise<Permission[]>; | ||
onPermissionsForOrg(organization: Organization, callback: Function): SubscriptionHandler; | ||
onPermissionsForOrg(organization: Organization, callback: SubscriptionCallback<Permission[]>): SubscriptionHandler; | ||
app(organization: Organization, filters: AppFilters): Promise<App>; | ||
apps(filters: AppFilters): Promise<App[]>; | ||
appForOrg(organization: Organization): Promise<App>; | ||
onAppForOrg(organization: Organization, filters: AppFilters, callback: SubscriptionCallback<App>): SubscriptionHandler; | ||
appsForOrg(organization: Organization): Promise<App[]>; | ||
onAppForOrg(organization: Organization, filters: AppFilters, callback: Function): SubscriptionHandler; | ||
onAppsForOrg(organization: Organization, filters: AppFilters, callback: Function): SubscriptionHandler; | ||
repoForApp(organization: Organization, appAddress: string): Promise<Repo>; | ||
appByAddress(organization: Organization, appAddress: string): Promise<App>; | ||
rolesForAddress(organization: Organization, appAddress: string): Promise<Role[]>; | ||
onAppsForOrg(organization: Organization, filters: AppFilters, callback: SubscriptionCallback<App[]>): SubscriptionHandler; | ||
repoForApp(organization: Organization, appAddress: Address): Promise<Repo>; | ||
appByAddress(organization: Organization, appAddress: Address): Promise<App>; | ||
rolesForAddress(organization: Organization, appAddress: Address): Promise<Role[]>; | ||
} | ||
export default ConnectorJson; | ||
//# sourceMappingURL=ConnectorJson.d.ts.map |
@@ -54,2 +54,7 @@ "use strict"; | ||
} | ||
onAppForOrg(organization, filters, callback) { | ||
return { | ||
unsubscribe: () => { }, | ||
}; | ||
} | ||
appsForOrg(organization) { | ||
@@ -60,7 +65,2 @@ return new Promise((resolve) => { | ||
} | ||
onAppForOrg(organization, filters, callback) { | ||
return { | ||
unsubscribe: () => { }, | ||
}; | ||
} | ||
onAppsForOrg(organization, filters, callback) { | ||
@@ -67,0 +67,0 @@ return { |
@@ -1,2 +0,2 @@ | ||
import { AppFilters, Network, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { AppFilters, Network, SubscriptionCallback, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { ConnectionContext } from '../types'; | ||
@@ -14,11 +14,11 @@ import App from '../entities/App'; | ||
}; | ||
connect?(connection: ConnectionContext): Promise<void>; | ||
disconnect?(): Promise<void>; | ||
appByAddress(organization: Organization, appAddress: string): Promise<App>; | ||
appForOrg(organization: Organization, filters?: AppFilters): Promise<App>; | ||
onAppForOrg(organization: Organization, filters: AppFilters, callback: SubscriptionCallback<App>): SubscriptionHandler; | ||
appsForOrg(organization: Organization, filters?: AppFilters): Promise<App[]>; | ||
connect?(connection: ConnectionContext): Promise<void>; | ||
disconnect?(): Promise<void>; | ||
onAppForOrg(organization: Organization, filters: AppFilters, callback: Function): SubscriptionHandler; | ||
onAppsForOrg(organization: Organization, filters: AppFilters, callback: Function): SubscriptionHandler; | ||
onPermissionsForOrg(organization: Organization, callback: Function): SubscriptionHandler; | ||
onAppsForOrg(organization: Organization, filters: AppFilters, callback: SubscriptionCallback<App[]>): SubscriptionHandler; | ||
permissionsForOrg(organization: Organization): Promise<Permission[]>; | ||
onPermissionsForOrg(organization: Organization, callback: SubscriptionCallback<Permission[]>): SubscriptionHandler; | ||
repoForApp(organization: Organization, appAddress: string): Promise<Repo>; | ||
@@ -25,0 +25,0 @@ rolesForAddress(organization: Organization, appAddress: string): Promise<Role[]>; |
@@ -49,3 +49,4 @@ import Organization from './Organization'; | ||
get appName(): string; | ||
toJSON(): never; | ||
} | ||
//# sourceMappingURL=App.d.ts.map |
@@ -69,2 +69,10 @@ "use strict"; | ||
} | ||
toJSON() { | ||
return { | ||
...this, | ||
// Organization creates a cycling reference that makes | ||
// the object impossible to pass through JSON.stringify(). | ||
organization: null, | ||
}; | ||
} | ||
} | ||
@@ -71,0 +79,0 @@ exports.default = App; |
@@ -1,2 +0,2 @@ | ||
import { Address, AppFiltersParam, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { Address, AppFiltersParam, SubscriptionHandler, SubscriptionCallback } from '@aragon/connect-types'; | ||
import { ConnectionContext } from '../types'; | ||
@@ -6,4 +6,4 @@ import TransactionIntent from '../transactions/TransactionIntent'; | ||
import Permission from './Permission'; | ||
declare type OnAppCallback = (app: App) => void; | ||
declare type OnAppsCallback = (apps: App[]) => void; | ||
declare type OnAppCallback = SubscriptionCallback<App>; | ||
declare type OnAppsCallback = SubscriptionCallback<App[]>; | ||
export default class Organization { | ||
@@ -20,3 +20,3 @@ readonly connection: ConnectionContext; | ||
permissions(): Promise<Permission[]>; | ||
onPermissions(callback: Function): SubscriptionHandler; | ||
onPermissions(callback: SubscriptionCallback<Permission[]>): SubscriptionHandler; | ||
appIntent(appAddress: Address, functionName: string, functionArgs: any[]): TransactionIntent; | ||
@@ -23,0 +23,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import TransactionPath from './TransactionPath'; | ||
@@ -15,3 +15,3 @@ import TransactionRequest from './TransactionRequest'; | ||
readonly functionArgs: any[]; | ||
constructor(data: TransactionIntentData, org: Organization, provider: ethers.providers.Provider); | ||
constructor(data: TransactionIntentData, org: Organization, provider: ethersProviders.Provider); | ||
paths(account: string, options?: { | ||
@@ -18,0 +18,0 @@ as?: string; |
@@ -1,7 +0,7 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders, utils as ethersUtils } from 'ethers'; | ||
import { Address, Network } from '@aragon/connect-types'; | ||
import IOrganizationConnector from './connections/IOrganizationConnector'; | ||
export declare type Metadata = (AragonArtifact | AragonManifest)[]; | ||
export declare type FunctionFragment = ethers.utils.FunctionFragment; | ||
export declare type Abi = (ethers.utils.EventFragment | ethers.utils.FunctionFragment)[]; | ||
export declare type FunctionFragment = ethersUtils.FunctionFragment; | ||
export declare type Abi = (ethersUtils.EventFragment | ethersUtils.FunctionFragment)[]; | ||
export interface AppIntent { | ||
@@ -109,3 +109,3 @@ roles: string[]; | ||
ethereumProvider: object | null; | ||
ethersProvider: ethers.providers.Provider; | ||
ethersProvider: ethersProviders.Provider; | ||
ipfs: (cid: string) => string; | ||
@@ -112,0 +112,0 @@ network: Network; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const ethers_1 = require("ethers"); | ||
exports.apmAppId = (appName) => ethers_1.ethers.utils.namehash(`${appName}.aragonpm.eth`); | ||
exports.apmAppId = (appName) => ethers_1.utils.namehash(`${appName}.aragonpm.eth`); | ||
// Is the given method a full signature, e.g. 'foo(arg1,arg2,...)' | ||
@@ -41,3 +41,3 @@ exports.isFullMethodSignature = (methodSignature) => { | ||
// Hash signature with Ethereum Identity and silce bytes | ||
const sigHash = ethers_1.ethers.utils.hexDataSlice(ethers_1.ethers.utils.id(siganture), 0, 4); | ||
const sigHash = ethers_1.utils.hexDataSlice(ethers_1.utils.id(siganture), 0, 4); | ||
return sigHash === methodId; | ||
@@ -44,0 +44,0 @@ }; |
@@ -78,4 +78,4 @@ "use strict"; | ||
return actions.reduce((script, { to, data }) => { | ||
const address = ethers_1.ethers.utils.defaultAbiCoder.encode(['address'], [to]); | ||
const dataLength = ethers_1.ethers.utils.defaultAbiCoder.encode(['uint256'], [(data.length - 2) / 2]); | ||
const address = ethers_1.utils.defaultAbiCoder.encode(['address'], [to]); | ||
const dataLength = ethers_1.utils.defaultAbiCoder.encode(['uint256'], [(data.length - 2) / 2]); | ||
return script + address.slice(26) + dataLength.slice(58) + data.slice(2); | ||
@@ -82,0 +82,0 @@ }, exports.CALLSCRIPT_ID); |
@@ -1,6 +0,6 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import App from '../entities/App'; | ||
import TransactionRequest from '../transactions/TransactionRequest'; | ||
import { TransactionWithChildren } from './path/decodePath'; | ||
export declare function describeTransaction(transaction: TransactionWithChildren, apps: App[], provider?: ethers.providers.Provider): Promise<TransactionRequest>; | ||
export declare function describeTransaction(transaction: TransactionWithChildren, apps: App[], provider?: ethersProviders.Provider): Promise<TransactionRequest>; | ||
/** | ||
@@ -10,4 +10,4 @@ * Use radspec to create a human-readable description for each transaction in the given `path` | ||
*/ | ||
export declare function describeTransactionPath(path: TransactionWithChildren[], apps: App[], provider?: ethers.providers.Provider): Promise<TransactionRequest[]>; | ||
export declare function describeScript(script: string, apps: App[], provider?: ethers.providers.Provider): Promise<TransactionRequest[]>; | ||
export declare function describeTransactionPath(path: TransactionWithChildren[], apps: App[], provider?: ethersProviders.Provider): Promise<TransactionRequest[]>; | ||
export declare function describeScript(script: string, apps: App[], provider?: ethersProviders.Provider): Promise<TransactionRequest[]>; | ||
//# sourceMappingURL=descriptions.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
export declare const FORWARD_SIG = "0xd948d468"; | ||
@@ -25,3 +25,3 @@ /** | ||
*/ | ||
export declare function canForward(forwarderAddress: string, sender: string, script: string, provider: ethers.providers.Provider): Promise<boolean>; | ||
export declare function canForward(forwarderAddress: string, sender: string, script: string, provider: ethersProviders.Provider): Promise<boolean>; | ||
//# sourceMappingURL=forwarding.d.ts.map |
@@ -58,3 +58,3 @@ "use strict"; | ||
// Check if a token approval pretransaction is needed due to the forwarder requiring a fee | ||
const forwarder = new ethers_1.ethers.Contract(forwarderAddress, abis_1.forwarderAbi, provider); | ||
const forwarder = new ethers_1.Contract(forwarderAddress, abis_1.forwarderAbi, provider); | ||
return forwarder.canForward(sender, script).catch(() => false); | ||
@@ -61,0 +61,0 @@ } |
@@ -0,5 +1,6 @@ | ||
export * from './app-connectors'; | ||
export * from './descriptions'; | ||
export * from './misc'; | ||
export * from './network'; | ||
export * from './app-connectors'; | ||
export * from './subscriptions'; | ||
export { decodeCallScript, encodeCallScript } from './callScript'; | ||
@@ -6,0 +7,0 @@ export { fetchMetadata } from './metadata'; |
@@ -13,6 +13,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./app-connectors"), exports); | ||
__exportStar(require("./descriptions"), exports); | ||
__exportStar(require("./misc"), exports); | ||
__exportStar(require("./network"), exports); | ||
__exportStar(require("./app-connectors"), exports); | ||
__exportStar(require("./subscriptions"), exports); | ||
var callScript_1 = require("./callScript"); | ||
@@ -19,0 +20,0 @@ Object.defineProperty(exports, "decodeCallScript", { enumerable: true, get: function () { return callScript_1.decodeCallScript; } }); |
@@ -5,5 +5,5 @@ "use strict"; | ||
const ethers_1 = require("ethers"); | ||
const CORE_NAMESPACE = ethers_1.ethers.utils.solidityKeccak256(['string'], ['core']); | ||
const APP_ADDR_NAMESPACE = ethers_1.ethers.utils.solidityKeccak256(['string'], ['app']); | ||
const APP_BASES_NAMESPACE = ethers_1.ethers.utils.solidityKeccak256(['string'], ['base']); | ||
const CORE_NAMESPACE = ethers_1.utils.solidityKeccak256(['string'], ['core']); | ||
const APP_ADDR_NAMESPACE = ethers_1.utils.solidityKeccak256(['string'], ['app']); | ||
const APP_BASES_NAMESPACE = ethers_1.utils.solidityKeccak256(['string'], ['base']); | ||
const KERNEL_NAMESPACES_NAMES = new Map([ | ||
@@ -10,0 +10,0 @@ [CORE_NAMESPACE, 'Core'], |
@@ -22,3 +22,3 @@ "use strict"; | ||
try { | ||
metadata = await ethers_1.ethers.utils.fetchJson(url); | ||
metadata = await ethers_1.utils.fetchJson(url); | ||
} | ||
@@ -25,0 +25,0 @@ catch (error) { |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import App from '../../entities/App'; | ||
@@ -13,4 +13,4 @@ import { Transaction } from '../transactions'; | ||
*/ | ||
export declare function calculateTransactionPath(sender: string, destination: string, methodSignature: string, params: any[], apps: App[], provider: ethers.providers.Provider, finalForwarder?: string): Promise<PathData>; | ||
export declare function calculateTransactionPath(sender: string, destination: string, methodSignature: string, params: any[], apps: App[], provider: ethersProviders.Provider, finalForwarder?: string): Promise<PathData>; | ||
export {}; | ||
//# sourceMappingURL=calculatePath.d.ts.map |
@@ -144,3 +144,3 @@ "use strict"; | ||
const finalForwarderProvided = finalForwarder | ||
? ethers_1.ethers.utils.isAddress(finalForwarder) | ||
? ethers_1.utils.isAddress(finalForwarder) | ||
: false; | ||
@@ -147,0 +147,0 @@ const directTransaction = await transactions_1.createDirectTransactionForApp(sender, destinationApp, method.sig, params); |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import App from '../../entities/App'; | ||
@@ -7,4 +7,4 @@ import { TransactionRequestData } from '../../transactions/TransactionRequest'; | ||
*/ | ||
export declare function tryEvaluatingRadspec(intent: TransactionRequestData, apps: App[], provider?: ethers.providers.Provider): Promise<string>; | ||
export declare function tryEvaluatingRadspec(intent: TransactionRequestData, apps: App[], provider?: ethersProviders.Provider): Promise<string>; | ||
export { postprocessRadspecDescription, PostProcessDescription, } from './postprocess'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import { FunctionFragment } from '../types'; | ||
@@ -19,4 +19,4 @@ import App from '../entities/App'; | ||
export declare function createForwarderTransactionBuilder(sender: string, directTransaction: Transaction): Function; | ||
export declare function buildPretransaction(transaction: TransactionWithTokenData, provider: ethers.providers.Provider): Promise<Transaction | undefined>; | ||
export declare function buildForwardingFeePretransaction(forwardingTransaction: Transaction, provider: ethers.providers.Provider): Promise<Transaction | undefined>; | ||
export declare function buildPretransaction(transaction: TransactionWithTokenData, provider: ethersProviders.Provider): Promise<Transaction | undefined>; | ||
export declare function buildForwardingFeePretransaction(forwardingTransaction: Transaction, provider: ethersProviders.Provider): Promise<Transaction | undefined>; | ||
//# sourceMappingURL=transactions.d.ts.map |
@@ -15,3 +15,3 @@ "use strict"; | ||
} | ||
const ethersInterface = new ethers_1.ethers.utils.Interface([methodAbiFragment]); | ||
const ethersInterface = new ethers_1.utils.Interface([methodAbiFragment]); | ||
// The direct transaction we eventually want to perform | ||
@@ -22,3 +22,3 @@ return { | ||
to: destination, | ||
data: ethersInterface.encodeFunctionData(ethers_1.ethers.utils.FunctionFragment.from(methodAbiFragment), params), | ||
data: ethersInterface.encodeFunctionData(ethers_1.utils.FunctionFragment.from(methodAbiFragment), params), | ||
}; | ||
@@ -54,3 +54,3 @@ } | ||
function createForwarderTransactionBuilder(sender, directTransaction) { | ||
const forwarder = new ethers_1.ethers.utils.Interface(abis_1.forwarderAbi); | ||
const forwarder = new ethers_1.utils.Interface(abis_1.forwarderAbi); | ||
return (forwarderAddress, script) => ({ | ||
@@ -69,3 +69,3 @@ ...directTransaction, | ||
const approveSpender = spender || to; | ||
const tokenContract = new ethers_1.ethers.Contract(tokenAddress, abis_1.erc20ABI, provider); | ||
const tokenContract = new ethers_1.Contract(tokenAddress, abis_1.erc20ABI, provider); | ||
const balance = await tokenContract.balanceOf(from); | ||
@@ -84,3 +84,3 @@ const tokenValueBN = BigInt(tokenValue); | ||
} | ||
const erc20 = new ethers_1.ethers.utils.Interface(abis_1.erc20ABI); | ||
const erc20 = new ethers_1.utils.Interface(abis_1.erc20ABI); | ||
return { | ||
@@ -97,3 +97,3 @@ from, | ||
const { to: forwarderAddress, from } = forwardingTransaction; | ||
const forwarderFee = new ethers_1.ethers.Contract(forwarderAddress, abis_1.forwarderFeeAbi, provider); | ||
const forwarderFee = new ethers_1.Contract(forwarderAddress, abis_1.forwarderFeeAbi, provider); | ||
const feeDetails = { amount: BigInt(0), tokenAddress: '' }; | ||
@@ -100,0 +100,0 @@ try { |
@@ -1,2 +0,2 @@ | ||
import { AppFilters, Network, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { Address, AppFilters, Network, SubscriptionCallback, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { ConnectionContext } from '../types'; | ||
@@ -23,14 +23,14 @@ import IOrganizationConnector from './IOrganizationConnector'; | ||
permissionsForOrg(): Promise<Permission[]>; | ||
onPermissionsForOrg(organization: Organization, callback: Function): SubscriptionHandler; | ||
onPermissionsForOrg(organization: Organization, callback: SubscriptionCallback<Permission[]>): SubscriptionHandler; | ||
app(organization: Organization, filters: AppFilters): Promise<App>; | ||
apps(filters: AppFilters): Promise<App[]>; | ||
appForOrg(organization: Organization): Promise<App>; | ||
onAppForOrg(organization: Organization, filters: AppFilters, callback: SubscriptionCallback<App>): SubscriptionHandler; | ||
appsForOrg(organization: Organization): Promise<App[]>; | ||
onAppForOrg(organization: Organization, filters: AppFilters, callback: Function): SubscriptionHandler; | ||
onAppsForOrg(organization: Organization, filters: AppFilters, callback: Function): SubscriptionHandler; | ||
repoForApp(organization: Organization, appAddress: string): Promise<Repo>; | ||
appByAddress(organization: Organization, appAddress: string): Promise<App>; | ||
rolesForAddress(organization: Organization, appAddress: string): Promise<Role[]>; | ||
onAppsForOrg(organization: Organization, filters: AppFilters, callback: SubscriptionCallback<App[]>): SubscriptionHandler; | ||
repoForApp(organization: Organization, appAddress: Address): Promise<Repo>; | ||
appByAddress(organization: Organization, appAddress: Address): Promise<App>; | ||
rolesForAddress(organization: Organization, appAddress: Address): Promise<Role[]>; | ||
} | ||
export default ConnectorJson; | ||
//# sourceMappingURL=ConnectorJson.d.ts.map |
@@ -52,2 +52,7 @@ // TODO: Remove these linting exceptions after implementation. | ||
} | ||
onAppForOrg(organization, filters, callback) { | ||
return { | ||
unsubscribe: () => { }, | ||
}; | ||
} | ||
appsForOrg(organization) { | ||
@@ -58,7 +63,2 @@ return new Promise((resolve) => { | ||
} | ||
onAppForOrg(organization, filters, callback) { | ||
return { | ||
unsubscribe: () => { }, | ||
}; | ||
} | ||
onAppsForOrg(organization, filters, callback) { | ||
@@ -65,0 +65,0 @@ return { |
@@ -1,2 +0,2 @@ | ||
import { AppFilters, Network, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { AppFilters, Network, SubscriptionCallback, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { ConnectionContext } from '../types'; | ||
@@ -14,11 +14,11 @@ import App from '../entities/App'; | ||
}; | ||
connect?(connection: ConnectionContext): Promise<void>; | ||
disconnect?(): Promise<void>; | ||
appByAddress(organization: Organization, appAddress: string): Promise<App>; | ||
appForOrg(organization: Organization, filters?: AppFilters): Promise<App>; | ||
onAppForOrg(organization: Organization, filters: AppFilters, callback: SubscriptionCallback<App>): SubscriptionHandler; | ||
appsForOrg(organization: Organization, filters?: AppFilters): Promise<App[]>; | ||
connect?(connection: ConnectionContext): Promise<void>; | ||
disconnect?(): Promise<void>; | ||
onAppForOrg(organization: Organization, filters: AppFilters, callback: Function): SubscriptionHandler; | ||
onAppsForOrg(organization: Organization, filters: AppFilters, callback: Function): SubscriptionHandler; | ||
onPermissionsForOrg(organization: Organization, callback: Function): SubscriptionHandler; | ||
onAppsForOrg(organization: Organization, filters: AppFilters, callback: SubscriptionCallback<App[]>): SubscriptionHandler; | ||
permissionsForOrg(organization: Organization): Promise<Permission[]>; | ||
onPermissionsForOrg(organization: Organization, callback: SubscriptionCallback<Permission[]>): SubscriptionHandler; | ||
repoForApp(organization: Organization, appAddress: string): Promise<Repo>; | ||
@@ -25,0 +25,0 @@ rolesForAddress(organization: Organization, appAddress: string): Promise<Role[]>; |
@@ -49,3 +49,4 @@ import Organization from './Organization'; | ||
get appName(): string; | ||
toJSON(): never; | ||
} | ||
//# sourceMappingURL=App.d.ts.map |
@@ -67,4 +67,12 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { | ||
} | ||
toJSON() { | ||
return { | ||
...this, | ||
// Organization creates a cycling reference that makes | ||
// the object impossible to pass through JSON.stringify(). | ||
organization: null, | ||
}; | ||
} | ||
} | ||
_metadata = new WeakMap(); | ||
//# sourceMappingURL=App.js.map |
@@ -1,2 +0,2 @@ | ||
import { Address, AppFiltersParam, SubscriptionHandler } from '@aragon/connect-types'; | ||
import { Address, AppFiltersParam, SubscriptionHandler, SubscriptionCallback } from '@aragon/connect-types'; | ||
import { ConnectionContext } from '../types'; | ||
@@ -6,4 +6,4 @@ import TransactionIntent from '../transactions/TransactionIntent'; | ||
import Permission from './Permission'; | ||
declare type OnAppCallback = (app: App) => void; | ||
declare type OnAppsCallback = (apps: App[]) => void; | ||
declare type OnAppCallback = SubscriptionCallback<App>; | ||
declare type OnAppsCallback = SubscriptionCallback<App[]>; | ||
export default class Organization { | ||
@@ -20,3 +20,3 @@ readonly connection: ConnectionContext; | ||
permissions(): Promise<Permission[]>; | ||
onPermissions(callback: Function): SubscriptionHandler; | ||
onPermissions(callback: SubscriptionCallback<Permission[]>): SubscriptionHandler; | ||
appIntent(appAddress: Address, functionName: string, functionArgs: any[]): TransactionIntent; | ||
@@ -23,0 +23,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import TransactionPath from './TransactionPath'; | ||
@@ -15,3 +15,3 @@ import TransactionRequest from './TransactionRequest'; | ||
readonly functionArgs: any[]; | ||
constructor(data: TransactionIntentData, org: Organization, provider: ethers.providers.Provider); | ||
constructor(data: TransactionIntentData, org: Organization, provider: ethersProviders.Provider); | ||
paths(account: string, options?: { | ||
@@ -18,0 +18,0 @@ as?: string; |
@@ -1,7 +0,7 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders, utils as ethersUtils } from 'ethers'; | ||
import { Address, Network } from '@aragon/connect-types'; | ||
import IOrganizationConnector from './connections/IOrganizationConnector'; | ||
export declare type Metadata = (AragonArtifact | AragonManifest)[]; | ||
export declare type FunctionFragment = ethers.utils.FunctionFragment; | ||
export declare type Abi = (ethers.utils.EventFragment | ethers.utils.FunctionFragment)[]; | ||
export declare type FunctionFragment = ethersUtils.FunctionFragment; | ||
export declare type Abi = (ethersUtils.EventFragment | ethersUtils.FunctionFragment)[]; | ||
export interface AppIntent { | ||
@@ -109,3 +109,3 @@ roles: string[]; | ||
ethereumProvider: object | null; | ||
ethersProvider: ethers.providers.Provider; | ||
ethersProvider: ethersProviders.Provider; | ||
ipfs: (cid: string) => string; | ||
@@ -112,0 +112,0 @@ network: Network; |
@@ -1,3 +0,3 @@ | ||
import { ethers } from 'ethers'; | ||
export const apmAppId = (appName) => ethers.utils.namehash(`${appName}.aragonpm.eth`); | ||
import { utils as ethersUtils } from 'ethers'; | ||
export const apmAppId = (appName) => ethersUtils.namehash(`${appName}.aragonpm.eth`); | ||
// Is the given method a full signature, e.g. 'foo(arg1,arg2,...)' | ||
@@ -36,3 +36,3 @@ export const isFullMethodSignature = (methodSignature) => { | ||
// Hash signature with Ethereum Identity and silce bytes | ||
const sigHash = ethers.utils.hexDataSlice(ethers.utils.id(siganture), 0, 4); | ||
const sigHash = ethersUtils.hexDataSlice(ethersUtils.id(siganture), 0, 4); | ||
return sigHash === methodId; | ||
@@ -39,0 +39,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { utils as ethersUtils } from 'ethers'; | ||
export const CALLSCRIPT_ID = '0x00000001'; | ||
@@ -73,4 +73,4 @@ function decodeSegment(script) { | ||
return actions.reduce((script, { to, data }) => { | ||
const address = ethers.utils.defaultAbiCoder.encode(['address'], [to]); | ||
const dataLength = ethers.utils.defaultAbiCoder.encode(['uint256'], [(data.length - 2) / 2]); | ||
const address = ethersUtils.defaultAbiCoder.encode(['address'], [to]); | ||
const dataLength = ethersUtils.defaultAbiCoder.encode(['uint256'], [(data.length - 2) / 2]); | ||
return script + address.slice(26) + dataLength.slice(58) + data.slice(2); | ||
@@ -77,0 +77,0 @@ }, CALLSCRIPT_ID); |
@@ -1,6 +0,6 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import App from '../entities/App'; | ||
import TransactionRequest from '../transactions/TransactionRequest'; | ||
import { TransactionWithChildren } from './path/decodePath'; | ||
export declare function describeTransaction(transaction: TransactionWithChildren, apps: App[], provider?: ethers.providers.Provider): Promise<TransactionRequest>; | ||
export declare function describeTransaction(transaction: TransactionWithChildren, apps: App[], provider?: ethersProviders.Provider): Promise<TransactionRequest>; | ||
/** | ||
@@ -10,4 +10,4 @@ * Use radspec to create a human-readable description for each transaction in the given `path` | ||
*/ | ||
export declare function describeTransactionPath(path: TransactionWithChildren[], apps: App[], provider?: ethers.providers.Provider): Promise<TransactionRequest[]>; | ||
export declare function describeScript(script: string, apps: App[], provider?: ethers.providers.Provider): Promise<TransactionRequest[]>; | ||
export declare function describeTransactionPath(path: TransactionWithChildren[], apps: App[], provider?: ethersProviders.Provider): Promise<TransactionRequest[]>; | ||
export declare function describeScript(script: string, apps: App[], provider?: ethersProviders.Provider): Promise<TransactionRequest[]>; | ||
//# sourceMappingURL=descriptions.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
export declare const FORWARD_SIG = "0xd948d468"; | ||
@@ -25,3 +25,3 @@ /** | ||
*/ | ||
export declare function canForward(forwarderAddress: string, sender: string, script: string, provider: ethers.providers.Provider): Promise<boolean>; | ||
export declare function canForward(forwarderAddress: string, sender: string, script: string, provider: ethersProviders.Provider): Promise<boolean>; | ||
//# sourceMappingURL=forwarding.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { Contract } from 'ethers'; | ||
import { forwarderAbi } from './abis'; | ||
@@ -53,5 +53,5 @@ export const FORWARD_SIG = '0xd948d468'; // function forward(bytes) | ||
// Check if a token approval pretransaction is needed due to the forwarder requiring a fee | ||
const forwarder = new ethers.Contract(forwarderAddress, forwarderAbi, provider); | ||
const forwarder = new Contract(forwarderAddress, forwarderAbi, provider); | ||
return forwarder.canForward(sender, script).catch(() => false); | ||
} | ||
//# sourceMappingURL=forwarding.js.map |
@@ -0,5 +1,6 @@ | ||
export * from './app-connectors'; | ||
export * from './descriptions'; | ||
export * from './misc'; | ||
export * from './network'; | ||
export * from './app-connectors'; | ||
export * from './subscriptions'; | ||
export { decodeCallScript, encodeCallScript } from './callScript'; | ||
@@ -6,0 +7,0 @@ export { fetchMetadata } from './metadata'; |
@@ -0,5 +1,6 @@ | ||
export * from './app-connectors'; | ||
export * from './descriptions'; | ||
export * from './misc'; | ||
export * from './network'; | ||
export * from './app-connectors'; | ||
export * from './subscriptions'; | ||
export { decodeCallScript, encodeCallScript } from './callScript'; | ||
@@ -6,0 +7,0 @@ export { fetchMetadata } from './metadata'; |
@@ -1,5 +0,5 @@ | ||
import { ethers } from 'ethers'; | ||
const CORE_NAMESPACE = ethers.utils.solidityKeccak256(['string'], ['core']); | ||
const APP_ADDR_NAMESPACE = ethers.utils.solidityKeccak256(['string'], ['app']); | ||
const APP_BASES_NAMESPACE = ethers.utils.solidityKeccak256(['string'], ['base']); | ||
import { utils as ethersUtils } from 'ethers'; | ||
const CORE_NAMESPACE = ethersUtils.solidityKeccak256(['string'], ['core']); | ||
const APP_ADDR_NAMESPACE = ethersUtils.solidityKeccak256(['string'], ['app']); | ||
const APP_BASES_NAMESPACE = ethersUtils.solidityKeccak256(['string'], ['base']); | ||
const KERNEL_NAMESPACES_NAMES = new Map([ | ||
@@ -6,0 +6,0 @@ [CORE_NAMESPACE, 'Core'], |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { utils as ethersUtils } from 'ethers'; | ||
import { getApmInternalAppInfo, getAragonOsInternalAppInfo, hasAppInfo, } from './overrides/index'; | ||
@@ -18,3 +18,3 @@ import { DEFAULT_IPFS_GATEWAY } from '../params'; | ||
try { | ||
metadata = await ethers.utils.fetchJson(url); | ||
metadata = await ethersUtils.fetchJson(url); | ||
} | ||
@@ -21,0 +21,0 @@ catch (error) { |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import App from '../../entities/App'; | ||
@@ -13,4 +13,4 @@ import { Transaction } from '../transactions'; | ||
*/ | ||
export declare function calculateTransactionPath(sender: string, destination: string, methodSignature: string, params: any[], apps: App[], provider: ethers.providers.Provider, finalForwarder?: string): Promise<PathData>; | ||
export declare function calculateTransactionPath(sender: string, destination: string, methodSignature: string, params: any[], apps: App[], provider: ethersProviders.Provider, finalForwarder?: string): Promise<PathData>; | ||
export {}; | ||
//# sourceMappingURL=calculatePath.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { utils as ethersUtils } from 'ethers'; | ||
import { addressesEqual, includesAddress, ANY_ENTITY } from '../address'; | ||
@@ -141,3 +141,3 @@ import { isFullMethodSignature } from '../app'; | ||
const finalForwarderProvided = finalForwarder | ||
? ethers.utils.isAddress(finalForwarder) | ||
? ethersUtils.isAddress(finalForwarder) | ||
: false; | ||
@@ -144,0 +144,0 @@ const directTransaction = await createDirectTransactionForApp(sender, destinationApp, method.sig, params); |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import App from '../../entities/App'; | ||
@@ -7,4 +7,4 @@ import { TransactionRequestData } from '../../transactions/TransactionRequest'; | ||
*/ | ||
export declare function tryEvaluatingRadspec(intent: TransactionRequestData, apps: App[], provider?: ethers.providers.Provider): Promise<string>; | ||
export declare function tryEvaluatingRadspec(intent: TransactionRequestData, apps: App[], provider?: ethersProviders.Provider): Promise<string>; | ||
export { postprocessRadspecDescription, PostProcessDescription, } from './postprocess'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { providers as ethersProviders } from 'ethers'; | ||
import { FunctionFragment } from '../types'; | ||
@@ -19,4 +19,4 @@ import App from '../entities/App'; | ||
export declare function createForwarderTransactionBuilder(sender: string, directTransaction: Transaction): Function; | ||
export declare function buildPretransaction(transaction: TransactionWithTokenData, provider: ethers.providers.Provider): Promise<Transaction | undefined>; | ||
export declare function buildForwardingFeePretransaction(forwardingTransaction: Transaction, provider: ethers.providers.Provider): Promise<Transaction | undefined>; | ||
export declare function buildPretransaction(transaction: TransactionWithTokenData, provider: ethersProviders.Provider): Promise<Transaction | undefined>; | ||
export declare function buildForwardingFeePretransaction(forwardingTransaction: Transaction, provider: ethersProviders.Provider): Promise<Transaction | undefined>; | ||
//# sourceMappingURL=transactions.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { ethers } from 'ethers'; | ||
import { Contract, utils as ethersUtils, } from 'ethers'; | ||
import { erc20ABI, forwarderAbi, forwarderFeeAbi } from './abis'; | ||
@@ -12,3 +12,3 @@ import { isFullMethodSignature } from './app'; | ||
} | ||
const ethersInterface = new ethers.utils.Interface([methodAbiFragment]); | ||
const ethersInterface = new ethersUtils.Interface([methodAbiFragment]); | ||
// The direct transaction we eventually want to perform | ||
@@ -19,3 +19,3 @@ return { | ||
to: destination, | ||
data: ethersInterface.encodeFunctionData(ethers.utils.FunctionFragment.from(methodAbiFragment), params), | ||
data: ethersInterface.encodeFunctionData(ethersUtils.FunctionFragment.from(methodAbiFragment), params), | ||
}; | ||
@@ -49,3 +49,3 @@ } | ||
export function createForwarderTransactionBuilder(sender, directTransaction) { | ||
const forwarder = new ethers.utils.Interface(forwarderAbi); | ||
const forwarder = new ethersUtils.Interface(forwarderAbi); | ||
return (forwarderAddress, script) => ({ | ||
@@ -63,3 +63,3 @@ ...directTransaction, | ||
const approveSpender = spender || to; | ||
const tokenContract = new ethers.Contract(tokenAddress, erc20ABI, provider); | ||
const tokenContract = new Contract(tokenAddress, erc20ABI, provider); | ||
const balance = await tokenContract.balanceOf(from); | ||
@@ -78,3 +78,3 @@ const tokenValueBN = BigInt(tokenValue); | ||
} | ||
const erc20 = new ethers.utils.Interface(erc20ABI); | ||
const erc20 = new ethersUtils.Interface(erc20ABI); | ||
return { | ||
@@ -90,3 +90,3 @@ from, | ||
const { to: forwarderAddress, from } = forwardingTransaction; | ||
const forwarderFee = new ethers.Contract(forwarderAddress, forwarderFeeAbi, provider); | ||
const forwarderFee = new Contract(forwarderAddress, forwarderFeeAbi, provider); | ||
const feeDetails = { amount: BigInt(0), tokenAddress: '' }; | ||
@@ -93,0 +93,0 @@ try { |
{ | ||
"name": "@aragon/connect-core", | ||
"version": "0.6.0", | ||
"version": "0.7.0-beta.1", | ||
"license": "LGPL-3.0-or-later", | ||
@@ -8,2 +8,3 @@ "main": "dist/cjs/index.js", | ||
"types": "dist/cjs/index.d.ts", | ||
"sideEffects": false, | ||
"scripts": { | ||
@@ -10,0 +11,0 @@ "build": "yarn build:esm && yarn build:cjs", |
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
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1228398
292
11033