Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into vtransfer
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Jun 6, 2024
2 parents d7f6c84 + f6d77a3 commit 6fb3807
Show file tree
Hide file tree
Showing 42 changed files with 403 additions and 184 deletions.
3 changes: 2 additions & 1 deletion golang/cosmos/x/vlocalchain/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package vlocalchain
import (
"fmt"

sdkioerrors "cosmossdk.io/errors"
"github.com/Agoric/agoric-sdk/golang/cosmos/x/vlocalchain/keeper"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand All @@ -14,7 +15,7 @@ func NewHandler(keeper keeper.Keeper) sdk.Handler {
switch msg := msg.(type) {
default:
errMsg := fmt.Sprintf("Unrecognized vlocalchain Msg type: %T", msg)
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
return nil, sdkioerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
},
"resolutions": {
"**/protobufjs": "^7.2.6",
"**/@types/estree": "^1.0.0",
"**/@typescript-eslint/typescript-estree": "^7.7.1"
},
"engines": {
Expand Down
1 change: 1 addition & 0 deletions packages/ERTP/exported.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Purse as _Purse,
} from './src/types.js';
declare global {
// @ts-ignore TS2666: Exports and export assignments are not permitted in module augmentations.
export {
_Amount as Amount,
_Brand as Brand,
Expand Down
2 changes: 1 addition & 1 deletion packages/ERTP/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 91.21
"atLeast": 91.22
}
}
2 changes: 1 addition & 1 deletion packages/base-zone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 90.77
"atLeast": 91.11
}
}
2 changes: 1 addition & 1 deletion packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 86.74
"atLeast": 87.28
}
}
2 changes: 1 addition & 1 deletion packages/builders/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 74.23
"atLeast": 74.36
}
}
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
"timeout": "20m"
},
"typeCoverage": {
"atLeast": 80.48
"atLeast": 80.49
}
}
1 change: 1 addition & 0 deletions packages/governance/exported.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
GovernableStartFn as _GovernableStartFn,
} from './src/types.js';
declare global {
// @ts-ignore TS2666: Exports and export assignments are not permitted in module augmentations.
export {
_CommitteeElectoratePublic as CommitteeElectoratePublic,
_GovernableStartFn as GovernableStartFn,
Expand Down
2 changes: 1 addition & 1 deletion packages/inter-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 95.87
"atLeast": 95.81
}
}
1 change: 1 addition & 0 deletions packages/internal/exported.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from './src/lib-chainStorage.js';

declare global {
// @ts-ignore TS2666: Exports and export assignments are not permitted in module augmentations.
export {
_ERef as ERef,
_Marshaller as Marshaller,
Expand Down
2 changes: 1 addition & 1 deletion packages/internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 93.81
"atLeast": 93.89
}
}
3 changes: 2 additions & 1 deletion packages/internal/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable max-classes-per-file */
import type { Callable, RemotableBrand } from '@endo/eventual-send';
import type { RemotableBrand } from '@endo/eventual-send';
import type { Primitive } from '@endo/pass-style';
import type { Callable } from './utils.js';

export declare class Callback<I extends (...args: unknown[]) => any> {
private iface: I;
Expand Down
2 changes: 1 addition & 1 deletion packages/network/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@
"workerThreads": false
},
"typeCoverage": {
"atLeast": 89.39
"atLeast": 89.7
}
}
1 change: 1 addition & 0 deletions packages/notifier/exported.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from './src/types.js';

declare global {
// @ts-ignore TS2666: Exports and export assignments are not permitted in module augmentations.
export {
_EachTopic as EachTopic,
_IterableEachTopic as IterableEachTopic,
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
"access": "public"
},
"typeCoverage": {
"atLeast": 97.38
"atLeast": 97.1
}
}
52 changes: 52 additions & 0 deletions packages/orchestration/src/chain-info.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// UNTIL https://github.com/Agoric/agoric-sdk/issues/8879

/** @file temporary static lookup of chain info */

/** @import {CosmosChainInfo, EthChainInfo} from './types.js'; */

/** @typedef {CosmosChainInfo | EthChainInfo} ChainInfo */

// TODO generate this automatically with a build script drawing on data sources such as https://github.com/cosmos/chain-registry

export const wellKnownChainInfo =
/** @satisfies {Record<string, ChainInfo>} */ (
harden({
// https://github.com/cosmos/chain-registry/blob/master/stride/chain.json
stride: {
chainId: 'stride-1',
connections: {},
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
ibcHooksEnabled: true,
stakingTokens: [{ denom: 'ustride' }],
},
cosmos: {
chainId: 'cosmoshub-4',
connections: {},
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
ibcHooksEnabled: true,
stakingTokens: [{ denom: 'uatom' }],
},
celestia: {
chainId: 'celestia',
connections: {},
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
ibcHooksEnabled: true,
stakingTokens: [{ denom: 'utia' }],
},
osmosis: {
chainId: 'osmosis-1',
connections: {},
icaEnabled: true,
icqEnabled: true,
pfmEnabled: true,
ibcHooksEnabled: true,
stakingTokens: [{ denom: 'uosmo' }],
},
})
);
64 changes: 0 additions & 64 deletions packages/orchestration/src/chain-info.ts

This file was deleted.

18 changes: 15 additions & 3 deletions packages/orchestration/src/cosmos-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ export type CosmosChainInfo = {
icqEnabled: boolean;
pfmEnabled: boolean;
ibcHooksEnabled: boolean;

/**
*
* cf https://github.com/cosmos/chain-registry/blob/master/chain.schema.json#L117
*/
allowedMessages: TypeUrl[];
allowedQueries: TypeUrl[];
stakingTokens?: Array<{ denom: string }>;
};

export interface StakingAccountQueries {
Expand Down Expand Up @@ -219,3 +219,15 @@ export type IBCMsgTransferOptions = {
timeoutTimestamp?: MsgTransfer['timeoutTimestamp'];
memo?: string;
};

export type CosmosChainAccountMethods<CCI extends CosmosChainInfo> =
(CCI extends {
icaEnabled: true;
}
? IcaAccount
: {}) &
CCI extends {
stakingTokens: {};
}
? StakingAccountActions
: {};
22 changes: 15 additions & 7 deletions packages/orchestration/src/examples/swapExample.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import { orcUtils } from '../utils/orc.js';
* @import {Remote} from '@agoric/internal';
* @import {OrchestrationService} from '../service.js';
* @import {Baggage} from '@agoric/vat-data'
* @import {Zone} from '@agoric/zone';
* @import {NameHub} from '@agoric/vats';
*/

/** @type {ContractMeta} */
export const meta = {
privateArgsShape: {
agoricNames: M.remotable('agoricNames'),
localchain: M.remotable('localchain'),
orchestrationService: M.or(M.remotable('orchestration'), null),
storageNode: StorageNodeShape,
Expand All @@ -42,6 +43,7 @@ export const makeNatAmountShape = (brand, min) =>
/**
* @param {ZCF} zcf
* @param {{
* agoricNames: Remote<NameHub>;
* localchain: Remote<LocalChain>;
* orchestrationService: Remote<OrchestrationService>;
* storageNode: Remote<StorageNode>;
Expand All @@ -54,16 +56,22 @@ export const start = async (zcf, privateArgs, baggage) => {

const zone = makeDurableZone(baggage);

const { localchain, orchestrationService, storageNode, timerService } =
privateArgs;
const {
agoricNames,
localchain,
orchestrationService,
storageNode,
timerService,
} = privateArgs;

const { orchestrate } = makeOrchestrationFacade({
zone,
timerService,
zcf,
agoricNames,
localchain,
storageNode,
orchestrationService,
storageNode,
timerService,
zcf,
zone,
});

/** deprecated historical example */
Expand Down
18 changes: 13 additions & 5 deletions packages/orchestration/src/examples/unbondExample.contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import { makeOrchestrationFacade } from '../facade.js';
* @import {TimerService} from '@agoric/time';
* @import {Baggage} from '@agoric/vat-data';
* @import {LocalChain} from '@agoric/vats/src/localchain.js';
* @import {NameHub} from '@agoric/vats';
* @import {Remote} from '@agoric/internal';
* @import {OrchestrationService} from '../service.js';
*/

/**
* @param {ZCF} zcf
* @param {{
* agoricNames: Remote<NameHub>;
* localchain: Remote<LocalChain>;
* orchestrationService: Remote<OrchestrationService>;
* storageNode: Remote<StorageNode>;
Expand All @@ -23,17 +25,23 @@ import { makeOrchestrationFacade } from '../facade.js';
* @param {Baggage} baggage
*/
export const start = async (zcf, privateArgs, baggage) => {
const { localchain, orchestrationService, storageNode, timerService } =
privateArgs;
const {
agoricNames,
localchain,
orchestrationService,
storageNode,
timerService,
} = privateArgs;
const zone = makeDurableZone(baggage);

const { orchestrate } = makeOrchestrationFacade({
agoricNames,
localchain,
zone,
orchestrationService,
storageNode,
timerService,
zcf,
storageNode,
orchestrationService,
zone,
});

/** @type {OfferHandler} */
Expand Down
Loading

0 comments on commit 6fb3807

Please sign in to comment.