Merge pull request #157 from redstone-finance/asiaziola/loading-evolved-contract-source-from-gateway
feat: loading evolved contract source from gateway
This commit is contained in:
@@ -104,7 +104,7 @@ export class DefaultEvaluationOptions implements EvaluationOptions {
|
||||
saveState: false
|
||||
};
|
||||
|
||||
bundlerUrl = 'https://gateway.redstone.finance/';
|
||||
bundlerUrl = `https://d1o5nlqr4okus2.cloudfront.net/`;
|
||||
|
||||
gasLimit = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ export class DefaultCreateContract implements CreateContract {
|
||||
};
|
||||
}
|
||||
|
||||
const response = await fetch(`https://gateway.redstone.finance/gateway/contracts/deploy`, {
|
||||
const response = await fetch(`https://d1o5nlqr4okus2.cloudfront.net/gateway/contracts/deploy`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
headers: {
|
||||
|
||||
@@ -26,13 +26,10 @@ export class RedstoneGatewayContractDefinitionLoader extends ContractDefinitionL
|
||||
}
|
||||
|
||||
async doLoad<State>(contractTxId: string, forcedSrcTxId?: string): Promise<ContractDefinition<State>> {
|
||||
if (forcedSrcTxId) {
|
||||
// no support for the evolve yet..
|
||||
return await super.doLoad(contractTxId, forcedSrcTxId);
|
||||
}
|
||||
|
||||
try {
|
||||
const result: ContractDefinition<State> = await fetch(`${this.baseUrl}/gateway/contracts/${contractTxId}`)
|
||||
const result: ContractDefinition<State> = await fetch(
|
||||
`${this.baseUrl}/gateway/contract?txId=${contractTxId}${forcedSrcTxId ? `&srcTxId=${forcedSrcTxId}` : ''}`
|
||||
)
|
||||
.then((res) => {
|
||||
return res.ok ? res.json() : Promise.reject(res);
|
||||
})
|
||||
|
||||
@@ -79,7 +79,7 @@ export class Evolve implements ExecutionContextModifier {
|
||||
//FIXME: side-effect...
|
||||
executionContext.contractDefinition = newContractDefinition;
|
||||
executionContext.handler = newHandler;
|
||||
|
||||
executionContext.handler.initState(state);
|
||||
this.logger.debug('evolved to:', {
|
||||
evolve: evolvedSrcTxId,
|
||||
newSrcTxId: executionContext.contractDefinition.srcTxId,
|
||||
|
||||
Reference in New Issue
Block a user