@oasislabs/service
Advanced tools
Comparing version 1.0.0-rc.13 to 1.0.0-rc.14
@@ -101,3 +101,4 @@ export declare type DeployHeaderOptions = { | ||
parseFromCode: typeof parseFromCode; | ||
deployCode: typeof DeployHeader.deployCode; | ||
}; | ||
export {}; |
@@ -259,3 +259,4 @@ var __extends = (this && this.__extends) || (function () { | ||
parseFromCode: parseFromCode, | ||
deployCode: DeployHeader.deployCode, | ||
}; | ||
//# sourceMappingURL=header.js.map |
{ | ||
"name": "@oasislabs/service", | ||
"version": "1.0.0-rc.13", | ||
"version": "1.0.0-rc.14", | ||
"description": "", | ||
@@ -37,4 +37,4 @@ "keywords": [], | ||
"dependencies": { | ||
"@oasislabs/common": "^1.0.0-rc.8", | ||
"@oasislabs/confidential": "^1.0.0-rc.8", | ||
"@oasislabs/common": "^1.0.0-rc.9", | ||
"@oasislabs/confidential": "^1.0.0-rc.9", | ||
"@oasislabs/types": "^1.0.0-rc.2", | ||
@@ -51,3 +51,3 @@ "@types/pako": "^1.0.1", | ||
}, | ||
"gitHead": "b120377dc7628f89d6ed0591da3d1c687f78ea59" | ||
"gitHead": "ab83dcc22930b3ea15e99ace1cf2adfa18609461" | ||
} |
@@ -296,2 +296,3 @@ import { bytes } from '@oasislabs/common'; | ||
parseFromCode, | ||
deployCode: DeployHeader.deployCode, | ||
}; |
import { bytes } from '@oasislabs/common'; | ||
import { DeployHeader, DeployHeaderWriter } from '../src/deploy/header'; | ||
import { makeExpectedBytecode } from './utils'; | ||
@@ -97,16 +97,1 @@ describe('DeployHeader', () => { | ||
}); | ||
function makeExpectedBytecode(headerBody: any, bytecode: string): Uint8Array { | ||
let body = DeployHeaderWriter.body(headerBody); | ||
let version = DeployHeaderWriter.shortToBytes(DeployHeader.currentVersion()); | ||
let size = DeployHeaderWriter.shortToBytes(body.length); | ||
return new Uint8Array( | ||
Buffer.concat([ | ||
DeployHeader.prefix(), | ||
version, | ||
size, | ||
body, | ||
bytes.parseHex(bytecode), | ||
]) | ||
); | ||
} |
@@ -16,2 +16,3 @@ import { PublicKey, PrivateKey } from '@oasislabs/confidential'; | ||
import { OasisCoder } from '../src/coder/oasis'; | ||
import { makeExpectedBytecode } from './utils'; | ||
@@ -136,2 +137,23 @@ setGateway(new EmptyOasisGateway()); | ||
}); | ||
it('Service.at should accept a hex string', async () => { | ||
const address = '0x288e7e1cc60962f40d4d782950470e3705c5acf4'; | ||
const bin = bytes.toHex( | ||
new Uint8Array( | ||
require('fs').readFileSync('test/wasm/mantle-counter.wasm') | ||
) | ||
); | ||
const gateway = { | ||
getCode: () => { | ||
return { code: makeExpectedBytecode({ confidential: false }, bin) }; | ||
}, | ||
}; | ||
// @ts-ignore | ||
const s = await Service.at(address, { | ||
gateway, | ||
db: new DummyStorage(), | ||
}); | ||
expect(bytes.parseHex(address)).toEqual(s._inner.address); | ||
}); | ||
}); | ||
@@ -138,0 +160,0 @@ |
@@ -23,2 +23,3 @@ import * as EventEmitter from 'eventemitter3'; | ||
import { RpcRequest as FnRequest } from '../src/coder'; | ||
import { DeployHeader, DeployHeaderWriter } from '../src/deploy/header'; | ||
@@ -308,1 +309,19 @@ export class EmptyOasisGateway implements OasisGateway { | ||
} | ||
export function makeExpectedBytecode( | ||
headerBody: any, | ||
bytecode: string | ||
): Uint8Array { | ||
let body = DeployHeaderWriter.body(headerBody); | ||
let version = DeployHeaderWriter.shortToBytes(DeployHeader.currentVersion()); | ||
let size = DeployHeaderWriter.shortToBytes(body.length); | ||
return new Uint8Array( | ||
Buffer.concat([ | ||
DeployHeader.prefix(), | ||
version, | ||
size, | ||
body, | ||
bytes.parseHex(bytecode), | ||
]) | ||
); | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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 README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
6338309
107
56760
1
6