Skip to content

Commit

Permalink
Merge pull request #6 from dappflow/dappflow-rename
Browse files Browse the repository at this point in the history
coincierge -> dappflow
  • Loading branch information
valerioleo authored Mar 24, 2020
2 parents f3182a3 + f3e3298 commit 3d748bb
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "coincierge-node",
"name": "dappflow-node",
"version": "1.0.0",
"description": "Coincierge node.js SDK",
"main": "src/coincierge.js",
"description": "Dappflow node.js SDK",
"main": "src/dappflow.js",
"repository": {
"type": "git",
"url": "https://github.com/valerioleo/coincierge-node"
"url": "https://github.com/dappflow/dappflow-node"
},
"author": "Valerio Leo <[email protected]>",
"author": "Dappflow <[email protected]>",
"private": true,
"homepage": "https://coincierge.io",
"homepage": "https://dappflow.io",
"scripts": {
"integration": "node_modules/.bin/ava src/**/**.integration.js --serial --only"
},
Expand Down
4 changes: 2 additions & 2 deletions src/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ const createHttpAgentRoot = fetch => ({clientId, clientSecret}, settings) => {
const headers = {
Authorization: `Bearer ${accessToken}`,
'Idempotency-Key': method === 'POST' && settings.network_max_retry > 0
? `coincierge-node-retry-${uuid4()}`
? `dappflow-node-retry-${uuid4()}`
: null,
...defaultHeaders
};

const safeBody = headers["content-type"] === 'application/json' ? JSON.stringify(body) : body;
const safeBody = headers['Content-Type'].includes('application/json') ? JSON.stringify(body) : body;
const request = fetch(
apiUrl + path,
method,
Expand Down
4 changes: 2 additions & 2 deletions src/coincierge.js → src/dappflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const init = async ({clientSecret, clientId, privKey}, signer = sdkSigner(privKe
getAccessToken: getAccessToken({clientSecret, clientId})
});

const coincierge = {
const dappflow = {
...resources,
settings: SETTINGS // helpful to retrieve the current settings used
};

return coincierge;
return dappflow;
};

module.exports = {
Expand Down
12 changes: 6 additions & 6 deletions src/helpers.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
const contractCallFactory = (state, coincierge) => {
const contractCallFactory = (state, dappflow) => {
switch(state) {
case 'view': return coincierge.contracts.callContractMethod;
default: return coincierge.contracts.sendTransaction;
case 'view': return dappflow.contracts.callContractMethod;
default: return dappflow.contracts.sendTransaction;
}
};

const createMethodCalls = ({
contract,
appId,
coincierge,
dappflow,
signer
}) => {
const methods = {};
contract.abi
.filter(({type}) => type === 'function')
.forEach(method => {
const contractCall = contractCallFactory(method.stateMutability, coincierge);
const contractCall = contractCallFactory(method.stateMutability, dappflow);

methods[method.name] = contractCall({
appId,
Expand All @@ -24,7 +24,7 @@ const createMethodCalls = ({
contractAddress: contract.address,
methodInputs: method.inputs,
contractId: contract.id,
coincierge,
dappflow,
signer
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const createResourcesRoot = resourcesList => async ({
const resource = await resourceBuilder({
httpAgent: httpClient(httpAgent),
wsAgent: wsClient(wsAgent),
coincierge: builtResources,
dappflow: builtResources,
signer,
getAccessToken
});
Expand Down
22 changes: 11 additions & 11 deletions src/resources/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ const {createFormData} = require('../utils/files');
const createAppHandler = (
wsClient,
token,
coincierge,
dappflow,
signer
) => async ({...params}) => new Promise((res, rej) => {
const {organization: {id: orgId}} = coincierge;
const {organization: {id: orgId}} = dappflow;

wsClient({orgId}).subscribe(async ws => {
ws.send(JSON.stringify({token}));
Expand Down Expand Up @@ -36,7 +36,7 @@ const createAppHandler = (
gasLimit,
gasPrice
});
const sub = await coincierge.transactions.finalize({txId, appId});
const sub = await dappflow.transactions.finalize({txId, appId});
sub.subscribe(ws => {
const data = JSON.stringify({signedTx: signedTx.toString('hex')});

Expand All @@ -62,31 +62,31 @@ const createAppHandler = (
});
});

const uploadAppTemplate = (httpAgent, coincierge) => templatePath => {
const {organization: {id: orgId}} = coincierge;
const uploadAppTemplate = (httpAgent, dappflow) => templatePath => {
const {organization: {id: orgId}} = dappflow;
const formData = createFormData(templatePath, ['.yml']);

return httpAgent(formData, {orgId}, formData.getHeaders());
};

const listApps = (httpAgent, coincierge) => () => {
const {organization: {id: orgId}} = coincierge;
const listApps = (httpAgent, dappflow) => () => {
const {organization: {id: orgId}} = dappflow;

return httpAgent({orgId});
}

const appResource = async ({
httpAgent,
wsAgent,
coincierge,
dappflow,
signer,
getAccessToken
}) => {
const basePath = '/orgs/{orgId}/apps';
const token = await getAccessToken();

const apps = {
create: createAppHandler(wsAgent({path: `${basePath}/create-app`}), token, coincierge, signer),
create: createAppHandler(wsAgent({path: `${basePath}/create-app`}), token, dappflow, signer),

fetch: httpAgent({
method: 'GET',
Expand All @@ -98,13 +98,13 @@ const appResource = async ({
method: 'GET',
path: basePath
}),
coincierge
dappflow
),

uploadTemplate: uploadAppTemplate(httpAgent({
method: 'POST',
path: `${basePath}/upload-template`
}), coincierge)
}), dappflow)
};

return {apps};
Expand Down
12 changes: 6 additions & 6 deletions src/resources/Contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const sendTransaction = (httpAgent, {
appId,
method,
contractId,
coincierge,
dappflow,
signer,
methodInputs
}) => async (params, from) => {
Expand Down Expand Up @@ -43,7 +43,7 @@ const sendTransaction = (httpAgent, {
gasPrice
});

const res = await coincierge.transactions.finalize({txId, appId});
const res = await dappflow.transactions.finalize({txId, appId});
const transactionStatusEventEmitter = new EventEmitter();
res.subscribe(ws => {
const data = JSON.stringify({signedTx: signedTx.toString('hex')});
Expand Down Expand Up @@ -84,7 +84,7 @@ const listContractTransactions = (httpAgent, contractId, appId) => () => {

const getInstanceInstanceHandler = async (
getInstance,
coincierge,
dappflow,
signer,
httpAgent,
{appId, contractId}
Expand All @@ -93,7 +93,7 @@ const getInstanceInstanceHandler = async (
const methodCalls = await createMethodCalls({
contract,
appId,
coincierge,
dappflow,
signer
});

Expand All @@ -112,7 +112,7 @@ const getInstanceInstanceHandler = async (

const contractResource = ({
httpAgent,
coincierge,
dappflow,
signer
}) => {
const basePath = '/apps/{appId}';
Expand All @@ -134,7 +134,7 @@ const contractResource = ({
method: 'GET',
path: `${basePath}/contracts/{contractId}`
}),
coincierge,
dappflow,
signer,
httpAgent
),
Expand Down

0 comments on commit 3d748bb

Please sign in to comment.