milkomeda-wsc-provider
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -46,3 +46,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const { from, to, value, data, nonce, gas: gasLimit, gasPrice: gasPriceArg } = transaction; | ||
const actorNonce = nonce !== null && nonce !== void 0 ? nonce : (yield provider.oracleRequest({ method: "eth_getActorNonce", params: [from] })); | ||
const actorNonce = nonce !== null && nonce !== void 0 ? nonce : (yield provider.oracleRequest({ | ||
method: "eth_getActorNonce", | ||
params: [from, provider.actorVersion], | ||
})); | ||
if (actorNonce === undefined) { | ||
@@ -70,3 +73,5 @@ throw new ProviderRpcError("Invalid nonce", JSON_RPC_ERROR_CODES.INVALID_PARAMS); | ||
}); | ||
const genesisHash = peraWallet.chainId === 416001 ? "wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=" : "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI="; | ||
const genesisHash = peraWallet.chainId === 416001 | ||
? "wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=" | ||
: "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI="; | ||
const algorandZeroTx = algosdk.makePaymentTxnWithSuggestedParamsFromObject({ | ||
@@ -95,3 +100,3 @@ from: algorandAddress, | ||
method: "eth_sendAlgActorTransaction", | ||
params: [l2TxPayload, salt].filter(Boolean), | ||
params: [Object.assign(Object.assign({}, l2TxPayload), { actorVersion: provider.actorVersion }), salt].filter(Boolean), | ||
}); | ||
@@ -98,0 +103,0 @@ } |
@@ -47,3 +47,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const { from, to, value, data, nonce, gas: gasLimit, gasPrice: gasPriceArg } = transaction; | ||
const actorNonce = nonce !== null && nonce !== void 0 ? nonce : (yield provider.oracleRequest({ method: "eth_getActorNonce", params: [from] })); | ||
const actorNonce = nonce !== null && nonce !== void 0 ? nonce : (yield provider.oracleRequest({ | ||
method: "eth_getActorNonce", | ||
params: [from, provider.actorVersion], | ||
})); | ||
if (actorNonce === undefined) { | ||
@@ -73,3 +76,3 @@ throw new ProviderRpcError("Invalid nonce", JSON_RPC_ERROR_CODES.INVALID_PARAMS); | ||
method: "eth_sendAdaActorTransaction", | ||
params: [signedTransaction, salt].filter(Boolean), | ||
params: [Object.assign(Object.assign({}, signedTransaction), { actorVersion: provider.actorVersion }), salt].filter(Boolean), | ||
}); | ||
@@ -76,0 +79,0 @@ } |
@@ -17,6 +17,8 @@ /// <reference types="node" /> | ||
readonly isMilkomeda = true; | ||
actorVersion: number | undefined; | ||
actorFactoryAddress: string | undefined; | ||
private nextId; | ||
constructor(oracleUrl: string, jsonRpcProviderUrl: string, type: ProviderType); | ||
setup(): Promise<void>; | ||
setup(actorVersion?: number): Promise<void>; | ||
changeActorVersion(actorVersion: number): Promise<void>; | ||
request(payload: RequestArguments): Promise<unknown>; | ||
@@ -23,0 +25,0 @@ oracleRequest<T>(payload: RequestArguments): Promise<T>; |
@@ -26,2 +26,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
this.isMilkomeda = true; | ||
this.actorVersion = undefined; | ||
this.actorFactoryAddress = undefined; | ||
@@ -41,11 +42,17 @@ this.nextId = 1; | ||
} | ||
setup() { | ||
setup(actorVersion) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.actorFactoryAddress = yield this.jsonRpcRequest(this.oracleUrl, { | ||
method: "eth_actorFactoryAddress", | ||
params: [], | ||
params: [actorVersion], | ||
}); | ||
this.actorVersion = actorVersion; | ||
this.emit("connect"); | ||
}); | ||
} | ||
changeActorVersion(actorVersion) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.setup(actorVersion); | ||
}); | ||
} | ||
request(payload) { | ||
@@ -52,0 +59,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -31,6 +31,8 @@ /// <reference types="mocha" /> | ||
isMilkomeda: boolean; | ||
actorVersion: number | undefined; | ||
actorFactoryAddress: string | undefined; | ||
peraWallet: PeraWalletConnect | undefined; | ||
algorandAccounts: string[]; | ||
setup(): Promise<void>; | ||
setup(actorVersion?: number): Promise<void>; | ||
changeActorVersion(actorVersion: number): Promise<void>; | ||
oracleRequest<T>(payload: RequestArguments): Promise<T>; | ||
@@ -37,0 +39,0 @@ providerRequest<T>(payload: RequestArguments): Promise<T>; |
{ | ||
"name": "milkomeda-wsc-provider", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "A JavaScript Ethereum Provider API for milkomeda wrapped smart contracts.", | ||
@@ -5,0 +5,0 @@ "license": "SGPL-1.0", |
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
104100
1129