-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#10045) closes: #10046 ## Description - use `AnyNatAmountShape` for `AmountArg` in `@agoric/orchestration` - Update `undelegate` to take `AmountArg` and `ChainAddress` - Update `undelegate` to accept and `bondDenom` - Finish `UnelegateAndTransfer` and `DepositAndDelegate` flows in staking-combinations contract ### Security Considerations n/a ### Scaling Considerations n/a ### Documentation Considerations n/a ### Testing Considerations Updates existing tests and includes tests for new functionality ### Upgrade Considerations n/a
- Loading branch information
Showing
25 changed files
with
394 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,73 @@ | ||
import { expectType } from 'tsd'; | ||
import type { Zone } from '@agoric/base-zone'; | ||
import type { Vow, VowTools } from '@agoric/vow'; | ||
import type { HostOf, GuestOf } from '../src/types.js'; | ||
import type { | ||
HostOf, | ||
GuestOf, | ||
HostInterface, | ||
GuestInterface, | ||
} from '../src/types.js'; | ||
|
||
const castable: unknown = null; | ||
const vt: VowTools = null as any; | ||
|
||
const sumVow = (a: number, b: number) => vt.asVow(() => a + b); | ||
|
||
const sumPromise = (a: number, b: number) => Promise.resolve(a + b); | ||
|
||
expectType<(p1: number, p2: number) => Promise<number>>( | ||
null as unknown as GuestOf<typeof sumVow>, | ||
castable as GuestOf<typeof sumVow>, | ||
); | ||
|
||
expectType<(p1: number, p2: number) => Vow<number>>( | ||
null as unknown as HostOf<typeof sumPromise>, | ||
castable as HostOf<typeof sumPromise>, | ||
); | ||
expectType<(p1: number, p2: number) => Vow<void>>( | ||
// @ts-expect-error incompatible return type | ||
null as unknown as HostOf<typeof sumPromise>, | ||
castable as HostOf<typeof sumPromise>, | ||
); | ||
|
||
// Test HostInterface and GuestInterface with an exoClass object | ||
type ExoAPIBase = { | ||
getValue: () => number; | ||
setValue: (value: number) => void; | ||
getCopyData: () => Record<string, number>[]; | ||
// TODO include `getRemote() => Guarded<...>`, since durable exos are passable | ||
}; | ||
type ExoGuestAPI = ExoAPIBase & { | ||
getValueAsync: () => Promise<number>; | ||
}; | ||
|
||
type ExoHostAPI = ExoAPIBase & { | ||
getValueAsync: () => Vow<number>; | ||
}; | ||
|
||
expectType< | ||
ExoAPIBase & { | ||
getValueAsync: () => Vow<number>; | ||
} | ||
>(castable as HostInterface<ExoGuestAPI>); | ||
expectType< | ||
ExoAPIBase & { | ||
getValueAsync: () => Promise<number>; | ||
} | ||
>(castable as GuestInterface<ExoHostAPI>); | ||
|
||
// Test HostInterface and GuestInterface with classKit (nested) objects | ||
expectType<{ | ||
facet: ExoAPIBase & { | ||
getValueAsync: () => Vow<number>; | ||
}; | ||
}>( | ||
castable as HostInterface<{ | ||
facet: ExoGuestAPI; | ||
}>, | ||
); | ||
expectType<{ | ||
facet: ExoAPIBase & { | ||
getValueAsync: () => Promise<number>; | ||
}; | ||
}>( | ||
castable as GuestInterface<{ | ||
facet: ExoHostAPI; | ||
}>, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.